移除create的工厂方法模式

This commit is contained in:
Nomango 2018-05-19 01:30:07 +08:00
parent 29f7d35844
commit f5c1d58134
44 changed files with 5 additions and 841 deletions

View File

@ -13,16 +13,6 @@ e2d::Animate::Animate(Animation * animation)
this->setAnimation(animation);
}
e2d::Animate * e2d::Animate::create()
{
return GC::create<Animate>();
}
e2d::Animate * e2d::Animate::create(Animation * animation)
{
return GC::create<Animate>(animation);
}
e2d::Animate::~Animate()
{
}

View File

@ -22,26 +22,6 @@ e2d::Animation::Animation(double interval, const std::vector<Image*>& frames)
this->add(frames);
}
e2d::Animation * e2d::Animation::create()
{
return GC::create<Animation>();
}
e2d::Animation * e2d::Animation::create(const std::vector<Image*>& frames)
{
return GC::create<Animation>(frames);
}
e2d::Animation * e2d::Animation::create(double interval)
{
return GC::create<Animation>(interval);
}
e2d::Animation * e2d::Animation::create(double interval, const std::vector<Image*>& frames)
{
return GC::create<Animation>(interval, frames);
}
e2d::Animation::~Animation()
{
}

View File

@ -5,11 +5,6 @@ e2d::CallFunc::CallFunc(const Function& func) :
{
}
e2d::CallFunc * e2d::CallFunc::create(const Function & func)
{
return GC::create<CallFunc>(func);
}
e2d::CallFunc * e2d::CallFunc::clone() const
{
return GC::create<CallFunc>(_func);

View File

@ -6,11 +6,6 @@ e2d::Delay::Delay(double duration)
{
}
e2d::Delay * e2d::Delay::create(double duration)
{
return GC::create<Delay>(duration);
}
e2d::Delay * e2d::Delay::clone() const
{
return GC::create<Delay>(_delay);

View File

@ -8,11 +8,6 @@ e2d::JumpBy::JumpBy(double duration, const Vector & vec, double height, int jump
{
}
e2d::JumpBy * e2d::JumpBy::create(double duration, const Vector & vec, double height, int jumps)
{
return GC::create<JumpBy>(duration, vec, height, jumps);
}
e2d::JumpBy * e2d::JumpBy::clone() const
{
return GC::create<JumpBy>(_duration, _deltaPos, _height, _jumps);

View File

@ -6,11 +6,6 @@ e2d::JumpTo::JumpTo(double duration, const Point & pos, double height, int jumps
{
}
e2d::JumpTo * e2d::JumpTo::create(double duration, const Point & pos, double height, int jumps)
{
return GC::create<JumpTo>(duration, pos, height, jumps);
}
e2d::JumpTo * e2d::JumpTo::clone() const
{
return GC::create<JumpTo>(_duration, _endPos, _height, _jumps);

View File

@ -15,11 +15,6 @@ e2d::Loop::Loop(Action * action, int times /* = -1 */)
}
}
e2d::Loop * e2d::Loop::create(Action * action, int times)
{
return GC::create<Loop>(action, times);
}
e2d::Loop::~Loop()
{
}

View File

@ -7,11 +7,6 @@ e2d::MoveBy::MoveBy(double duration, Vector vector)
_deltaPos = vector;
}
e2d::MoveBy * e2d::MoveBy::create(double duration, Vector vector)
{
return GC::create<MoveBy>(duration, vector);
}
void e2d::MoveBy::_init()
{
ActionGradual::_init();

View File

@ -6,11 +6,6 @@ e2d::MoveTo::MoveTo(double duration, Point pos)
_endPos = pos;
}
e2d::MoveTo * e2d::MoveTo::create(double duration, Point pos)
{
return GC::create<MoveTo>(duration, pos);
}
e2d::MoveTo * e2d::MoveTo::clone() const
{
return GC::create<MoveTo>(_duration, _endPos);

View File

@ -7,11 +7,6 @@ e2d::OpacityBy::OpacityBy(double duration, double opacity)
_deltaVal = opacity;
}
e2d::OpacityBy * e2d::OpacityBy::create(double duration, double opacity)
{
return GC::create<OpacityBy>(duration, opacity);
}
void e2d::OpacityBy::_init()
{
ActionGradual::_init();

View File

@ -7,11 +7,6 @@ e2d::OpacityTo::OpacityTo(double duration, double opacity)
_endVal = opacity;
}
e2d::OpacityTo * e2d::OpacityTo::create(double duration, double opacity)
{
return GC::create<OpacityTo>(duration, opacity);
}
e2d::OpacityTo * e2d::OpacityTo::clone() const
{
return GC::create<OpacityTo>(_duration, _endVal);

View File

@ -7,11 +7,6 @@ e2d::RotateBy::RotateBy(double duration, double rotation)
_deltaVal = rotation;
}
e2d::RotateBy * e2d::RotateBy::create(double duration, double rotation)
{
return GC::create<RotateBy>(duration, rotation);
}
void e2d::RotateBy::_init()
{
ActionGradual::_init();

View File

@ -7,11 +7,6 @@ e2d::RotateTo::RotateTo(double duration, double rotation)
_endVal = rotation;
}
e2d::RotateTo * e2d::RotateTo::create(double duration, double rotation)
{
return GC::create<RotateTo>(duration, rotation);
}
e2d::RotateTo * e2d::RotateTo::clone() const
{
return GC::create<RotateTo>(_duration, _endVal);

View File

@ -15,16 +15,6 @@ e2d::ScaleBy::ScaleBy(double duration, double scaleX, double scaleY)
_deltaY = scaleY;
}
e2d::ScaleBy * e2d::ScaleBy::create(double duration, double scale)
{
return GC::create<ScaleBy>(duration, scale);
}
e2d::ScaleBy * e2d::ScaleBy::create(double duration, double scaleX, double scaleY)
{
return GC::create<ScaleBy>(duration, scaleX, scaleY);
}
void e2d::ScaleBy::_init()
{
ActionGradual::_init();

View File

@ -14,16 +14,6 @@ e2d::ScaleTo::ScaleTo(double duration, double scaleX, double scaleY)
_endScaleY = scaleY;
}
e2d::ScaleTo * e2d::ScaleTo::create(double duration, double scale)
{
return GC::create<ScaleTo>(duration, scale);
}
e2d::ScaleTo * e2d::ScaleTo::create(double duration, double scaleX, double scaleY)
{
return GC::create<ScaleTo>(duration, scaleX, scaleY);
}
e2d::ScaleTo * e2d::ScaleTo::clone() const
{
return GC::create<ScaleTo>(_duration, _endScaleX, _endScaleY);

View File

@ -11,16 +11,6 @@ e2d::Sequence::Sequence(const std::vector<Action*>& actions)
this->add(actions);
}
e2d::Sequence * e2d::Sequence::create()
{
return GC::create<Sequence>();
}
e2d::Sequence * e2d::Sequence::create(const std::vector<Action*>& actions)
{
return GC::create<Sequence>(actions);
}
e2d::Sequence::~Sequence()
{
}

View File

@ -9,16 +9,6 @@ e2d::Spawn::Spawn(const std::vector<Action*>& actions)
this->add(actions);
}
e2d::Spawn * e2d::Spawn::create()
{
return GC::create<Spawn>();
}
e2d::Spawn * e2d::Spawn::create(const std::vector<Action*>& actions)
{
return GC::create<Spawn>(actions);
}
e2d::Spawn::~Spawn()
{
}

View File

@ -26,21 +26,6 @@ e2d::ColliderCircle::ColliderCircle(Node * node)
this->setAutoResize(true);
}
e2d::ColliderCircle * e2d::ColliderCircle::create()
{
return GC::create<ColliderCircle>();
}
e2d::ColliderCircle * e2d::ColliderCircle::create(Point center, double radius)
{
return GC::create<ColliderCircle>(center, radius);
}
e2d::ColliderCircle * e2d::ColliderCircle::create(Node * node)
{
return GC::create<ColliderCircle>(node);
}
e2d::ColliderCircle::~ColliderCircle()
{
SafeReleaseInterface(_d2dCircle);

View File

@ -26,21 +26,6 @@ e2d::ColliderEllipse::ColliderEllipse(Node * node)
this->setAutoResize(true);
}
e2d::ColliderEllipse * e2d::ColliderEllipse::create()
{
return GC::create<ColliderEllipse>();
}
e2d::ColliderEllipse * e2d::ColliderEllipse::create(Point center, double radiusX, double radiusY)
{
return GC::create<ColliderEllipse>(center, radiusX, radiusY);
}
e2d::ColliderEllipse * e2d::ColliderEllipse::create(Node * node)
{
return GC::create<ColliderEllipse>(node);
}
e2d::ColliderEllipse::~ColliderEllipse()
{
SafeReleaseInterface(_d2dEllipse);

View File

@ -19,21 +19,6 @@ e2d::ColliderRect::ColliderRect(Node * node)
this->setAutoResize(true);
}
e2d::ColliderRect * e2d::ColliderRect::create()
{
return GC::create<ColliderRect>();
}
e2d::ColliderRect * e2d::ColliderRect::create(double x, double y, double width, double height)
{
return GC::create<ColliderRect>(x, y, width, height);
}
e2d::ColliderRect * e2d::ColliderRect::create(Node * node)
{
return GC::create<ColliderRect>(node);
}
e2d::ColliderRect::~ColliderRect()
{
SafeReleaseInterface(_d2dRectangle);

View File

@ -42,31 +42,6 @@ e2d::Image::Image(int resNameId, const String& resType, double cropX, double cro
this->crop(cropX, cropY, cropWidth, cropHeight);
}
e2d::Image * e2d::Image::create()
{
return GC::create<Image>();
}
e2d::Image * e2d::Image::create(const String & filePath)
{
return GC::create<Image>(filePath);
}
e2d::Image * e2d::Image::create(int resNameId, const String & resType)
{
return GC::create<Image>(resNameId, resType);
}
e2d::Image * e2d::Image::create(const String & filePath, double cropX, double cropY, double cropWidth, double cropHeight)
{
return GC::create<Image>(filePath, cropX, cropY, cropWidth, cropHeight);
}
e2d::Image * e2d::Image::create(int resNameId, const String & resType, double cropX, double cropY, double cropWidth, double cropHeight)
{
return GC::create<Image>(resNameId, resType, cropX, cropY, cropWidth, cropHeight);
}
e2d::Image::~Image()
{
}

View File

@ -7,7 +7,7 @@ e2d::Scene::Scene()
, _colliderVisiable(false)
, _root(nullptr)
{
_root = Node::create();
_root = GC::create<Node>();
if (_root)
{
_root->retain();
@ -19,11 +19,6 @@ e2d::Scene::Scene()
}
}
e2d::Scene * e2d::Scene::create()
{
return GC::create<Scene>();
}
e2d::Scene::~Scene()
{
}

View File

@ -78,31 +78,6 @@ e2d::Button::Button(Node * normal, Node * mouseover, Node * selected, Node * dis
this->setClickFunc(func);
}
e2d::Button * e2d::Button::create()
{
return GC::create<Button>();
}
e2d::Button * e2d::Button::create(Node * normal, const Function & func)
{
return GC::create<Button>(normal, func);
}
e2d::Button * e2d::Button::create(Node * normal, Node * selected, const Function & func)
{
return GC::create<Button>(normal, selected, func);
}
e2d::Button * e2d::Button::create(Node * normal, Node * mouseover, Node * selected, const Function & func)
{
return GC::create<Button>(normal, mouseover, selected, func);
}
e2d::Button * e2d::Button::create(Node * normal, Node * mouseover, Node * selected, Node * disabled, const Function & func)
{
return GC::create<Button>(normal, mouseover, selected, disabled, func);
}
bool e2d::Button::isEnable() const
{
return _enable;

View File

@ -74,31 +74,6 @@ e2d::ButtonToggle::ButtonToggle(Node * toggleOnNormal, Node * toggleOffNormal, N
this->setClickFunc(func);
}
e2d::ButtonToggle * e2d::ButtonToggle::create()
{
return GC::create<ButtonToggle>();
}
e2d::ButtonToggle * e2d::ButtonToggle::create(Node * onNormal, Node * offNormal, const Function & func)
{
return GC::create<ButtonToggle>(onNormal, offNormal, func);
}
e2d::ButtonToggle * e2d::ButtonToggle::create(Node * onNormal, Node * offNormal, Node * onSelected, Node * offSelected, const Function & func)
{
return GC::create<ButtonToggle>(onNormal, offNormal, onSelected, offSelected, func);
}
e2d::ButtonToggle * e2d::ButtonToggle::create(Node * onNormal, Node * offNormal, Node * onMouseOver, Node * offMouseOver, Node * onSelected, Node * offSelected, const Function & func)
{
return GC::create<ButtonToggle>(onNormal, offNormal, onMouseOver, offMouseOver, onSelected, offSelected, func);
}
e2d::ButtonToggle * e2d::ButtonToggle::create(Node * onNormal, Node * offNormal, Node * onMouseOver, Node * offMouseOver, Node * onSelected, Node * offSelected, Node * onDisabled, Node * offDisabled, const Function & func)
{
return GC::create<ButtonToggle>(onNormal, offNormal, onMouseOver, offMouseOver, onSelected, offSelected, onDisabled, offDisabled, func);
}
bool e2d::ButtonToggle::getState() const
{
return _toggle;

View File

@ -14,16 +14,6 @@ e2d::Menu::Menu(const std::vector<Button*>& buttons)
}
}
e2d::Menu * e2d::Menu::create()
{
return GC::create<Menu>();
}
e2d::Menu * e2d::Menu::create(const std::vector<Button*>& buttons)
{
return GC::create<Menu>(buttons);
}
bool e2d::Menu::isEnable() const
{
return _enable;

View File

@ -41,11 +41,6 @@ e2d::Node::Node()
}
}
e2d::Node * e2d::Node::create()
{
return GC::create<Node>();
}
e2d::Node::~Node()
{
}

View File

@ -19,21 +19,6 @@ e2d::Circle::Circle(Point center, double radius)
this->setPivot(0.5, 0.5);
}
e2d::Circle * e2d::Circle::create()
{
return GC::create<Circle>();
}
e2d::Circle * e2d::Circle::create(double radius)
{
return GC::create<Circle>(radius);
}
e2d::Circle * e2d::Circle::create(Point center, double radius)
{
return GC::create<Circle>(center, radius);
}
e2d::Circle::~Circle()
{
}

View File

@ -22,21 +22,6 @@ e2d::Ellipse::Ellipse(Point center, double radiusX, double radiusY)
this->setPivot(0.5, 0.5);
}
e2d::Ellipse * e2d::Ellipse::create()
{
return GC::create<Ellipse>();
}
e2d::Ellipse * e2d::Ellipse::create(double radiusX, double radiusY)
{
return GC::create<Ellipse>(radiusX, radiusY);
}
e2d::Ellipse * e2d::Ellipse::create(Point center, double radiusX, double radiusY)
{
return GC::create<Ellipse>(center, radiusX, radiusY);
}
e2d::Ellipse::~Ellipse()
{
}

View File

@ -16,21 +16,6 @@ e2d::Rect::Rect(Point topLeft, Size size)
this->setSize(size);
}
e2d::Rect * e2d::Rect::create()
{
return GC::create<Rect>();
}
e2d::Rect * e2d::Rect::create(Size size)
{
return GC::create<Rect>(size);
}
e2d::Rect * e2d::Rect::create(Point topLeft, Size size)
{
return GC::create<Rect>(topLeft, size);
}
e2d::Rect::~Rect()
{
}

View File

@ -22,21 +22,6 @@ e2d::RoundRect::RoundRect(Point topLeft, Size size, double radiusX, double radiu
this->setSize(size);
}
e2d::RoundRect * e2d::RoundRect::create()
{
return GC::create<RoundRect>();
}
e2d::RoundRect * e2d::RoundRect::create(Size size, double radiusX, double radiusY)
{
return GC::create<RoundRect>(size, radiusX, radiusY);
}
e2d::RoundRect * e2d::RoundRect::create(Point topLeft, Size size, double radiusX, double radiusY)
{
return GC::create<RoundRect>(topLeft, size, radiusX, radiusY);
}
e2d::RoundRect::~RoundRect()
{
}

View File

@ -38,36 +38,6 @@ e2d::Sprite::Sprite(int resNameId, const String& resType, double x, double y, do
crop(x, y, width, height);
}
e2d::Sprite * e2d::Sprite::create()
{
return GC::create<Sprite>();
}
e2d::Sprite * e2d::Sprite::create(Image * image)
{
return GC::create<Sprite>(image);
}
e2d::Sprite * e2d::Sprite::create(const String & filePath)
{
return GC::create<Sprite>(filePath);
}
e2d::Sprite * e2d::Sprite::create(int resNameId, const String & resType)
{
return GC::create<Sprite>(resNameId, resType);
}
e2d::Sprite * e2d::Sprite::create(const String & filePath, double x, double y, double width, double height)
{
return GC::create<Sprite>(filePath, x, y, width, height);
}
e2d::Sprite * e2d::Sprite::create(int resNameId, const String & resType, double x, double y, double width, double height)
{
return GC::create<Sprite>(resNameId, resType, x, y, width, height);
}
e2d::Sprite::~Sprite()
{
}

View File

@ -90,16 +90,6 @@ e2d::Text::Text(const String & text, const Font & font, const Style & style)
_reset();
}
e2d::Text * e2d::Text::create()
{
return GC::create<Text>();
}
e2d::Text * e2d::Text::create(const String & text, const Font & font, const Style & style)
{
return GC::create<Text>(text, font, style);
}
e2d::Text::~Text()
{
SafeReleaseInterface(_textFormat);

View File

@ -68,21 +68,6 @@ e2d::Music::~Music()
close();
}
e2d::Music * e2d::Music::create()
{
return GC::create<Music>();
}
e2d::Music * e2d::Music::create(const e2d::String & filePath)
{
return GC::create<Music>(filePath);
}
e2d::Music * e2d::Music::create(int resNameId, const String & resType)
{
return GC::create<Music>(resNameId, resType);
}
bool e2d::Music::open(const e2d::String& filePath)
{
if (_opened)

View File

@ -6,11 +6,6 @@ e2d::TransitionEmerge::TransitionEmerge(double duration)
{
}
e2d::TransitionEmerge * e2d::TransitionEmerge::create(double duration)
{
return GC::create<TransitionEmerge>(duration);
}
void e2d::TransitionEmerge::_init(Scene * prev, Scene * next)
{
Transition::_init(prev, next);

View File

@ -17,16 +17,6 @@ e2d::TransitionFade::TransitionFade(double fadeOutDuration, double fadeInDuratio
{
}
e2d::TransitionFade * e2d::TransitionFade::create(double duration)
{
return GC::create<TransitionFade>(duration);
}
e2d::TransitionFade * e2d::TransitionFade::create(double fadeOutDuration, double fadeInDuration)
{
return GC::create<TransitionFade>(fadeOutDuration, fadeInDuration);
}
void e2d::TransitionFade::_init(Scene * prev, Scene * next)
{
Transition::_init(prev, next);

View File

@ -7,11 +7,6 @@ e2d::TransitionMove::TransitionMove(double duration, Direction direction)
{
}
e2d::TransitionMove * e2d::TransitionMove::create(double moveDuration, Direction direction)
{
return GC::create<TransitionMove>(moveDuration, direction);
}
void e2d::TransitionMove::_init(Scene * prev, Scene * next)
{
Transition::_init(prev, next);

View File

@ -127,12 +127,6 @@ public:
Vector vector /* 移动距离 */
);
// 创建相对位移动作
static MoveBy * create(
double duration, /* 持续时长 */
Vector vector /* 移动距离 */
);
// 获取该动作的拷贝对象
virtual MoveBy * clone() const override;
@ -162,12 +156,6 @@ public:
Point pos /* 目的坐标 */
);
// 创建位移动作
static MoveTo * create(
double duration, /* 持续时长 */
Point pos /* 目的坐标 */
);
// 获取该动作的拷贝对象
virtual MoveTo * clone() const override;
@ -199,14 +187,6 @@ public:
int jumps /* 跳跃次数 */
);
// 创建相对跳跃动作
static JumpBy * create(
double duration, /* 持续时长 */
const Vector& vec, /* 跳跃距离 */
double height, /* 跳跃高度 */
int jumps /* 跳跃次数 */
);
// 获取该动作的拷贝对象
virtual JumpBy * clone() const override;
@ -241,14 +221,6 @@ public:
int jumps /* 跳跃次数 */
);
// 创建位移动作
static JumpTo * create(
double duration, /* 持续时长 */
const Point& pos, /* 目的坐标 */
double height, /* 跳跃高度 */
int jumps /* 跳跃次数 */
);
// 获取该动作的拷贝对象
virtual JumpTo * clone() const override;
@ -284,19 +256,6 @@ public:
double scaleY /* 纵向缩放相对变化值 */
);
// 创建相对缩放动作
static ScaleBy * create(
double duration, /* 持续时长 */
double scale /* 相对变化值 */
);
// 创建相对缩放动作
static ScaleBy * create(
double duration, /* 持续时长 */
double scaleX, /* 横向缩放相对变化值 */
double scaleY /* 纵向缩放相对变化值 */
);
// 获取该动作的拷贝对象
virtual ScaleBy * clone() const override;
@ -334,19 +293,6 @@ public:
double scaleY /* 纵向缩放目标值 */
);
// 创建缩放动作
static ScaleTo * create(
double duration, /* 持续时长 */
double scale /* 目标值 */
);
// 创建缩放动作
static ScaleTo * create(
double duration, /* 持续时长 */
double scaleX, /* 横向缩放目标值 */
double scaleY /* 纵向缩放目标值 */
);
// 获取该动作的拷贝对象
virtual ScaleTo * clone() const override;
@ -377,12 +323,6 @@ public:
double opacity /* 相对变化值 */
);
// 创建透明度相对渐变动作
static OpacityBy * create(
double duration, /* 持续时长 */
double opacity /* 相对变化值 */
);
// 获取该动作的拷贝对象
virtual OpacityBy * clone() const override;
@ -412,12 +352,6 @@ public:
double opacity /* 目标值 */
);
// 创建透明度渐变动作
static OpacityTo * create(
double duration, /* 持续时长 */
double opacity /* 目标值 */
);
// 获取该动作的拷贝对象
virtual OpacityTo * clone() const override;
@ -477,12 +411,6 @@ public:
double rotation /* 相对变化值 */
);
// 创建相对旋转动作
static RotateBy * create(
double duration, /* 持续时长 */
double rotation /* 相对变化值 */
);
// 获取该动作的拷贝对象
virtual RotateBy * clone() const override;
@ -512,12 +440,6 @@ public:
double rotation /* 目标值 */
);
// 创建旋转动作
static RotateTo * create(
double duration, /* 持续时长 */
double rotation /* 目标值 */
);
// 获取该动作的拷贝对象
virtual RotateTo * clone() const override;
@ -546,11 +468,6 @@ public:
double duration /* 延迟时长(秒) */
);
// 创建延时动作
static Delay * create(
double duration /* 延迟时长(秒) */
);
// 获取该动作的拷贝对象
virtual Delay * clone() const override;
@ -586,12 +503,6 @@ public:
int times = -1 /* 循环次数 */
);
// 创建循环动作
static Loop * create(
Action * action, /* 执行循环的动作 */
int times = -1 /* 循环次数 */
);
virtual ~Loop();
// 获取该动作的拷贝对象
@ -632,11 +543,6 @@ public:
const Function& func /* 函数对象 */
);
// 创建执行函数对象的动作
static CallFunc * create(
const Function& func /* 函数对象 */
);
// 获取该动作的拷贝对象
virtual CallFunc * clone() const override;
@ -666,14 +572,6 @@ public:
const std::vector<Action*>& actions /* 动作列表 */
);
// 创建顺序动作
static Sequence * create();
// 创建顺序动作
static Sequence * create(
const std::vector<Action*>& actions /* 动作列表 */
);
virtual ~Sequence();
// 在结尾添加动作
@ -725,14 +623,6 @@ public:
const std::vector<Action*>& actions /* 动作列表 */
);
// 创建同步动作
static Spawn * create();
// 创建同步动作
static Spawn * create(
const std::vector<Action*>& actions /* 动作列表 */
);
virtual ~Spawn();
// 在结尾添加动作
@ -792,25 +682,6 @@ public:
const std::vector<Image*>& frames /* 关键帧数组 */
);
// 创建帧动画
static Animation * create();
// 创建帧动画
static Animation * create(
const std::vector<Image*>& frames /* 关键帧数组 */
);
// 创建特定帧间隔的帧动画
static Animation * create(
double interval /* 帧间隔(秒) */
);
// 创建特定帧间隔的帧动画
static Animation * create(
double interval, /* 帧间隔(秒) */
const std::vector<Image*>& frames /* 关键帧数组 */
);
virtual ~Animation();
// 添加关键帧
@ -857,14 +728,6 @@ public:
Animation * animation
);
// 创建精灵动作
static Animate * create();
// 创建精灵动作
static Animate * create(
Animation * animation
);
virtual ~Animate();
// 获取动画

View File

@ -9,6 +9,7 @@ namespace e2d
{
// 游戏控制
class Game
{
public:
@ -46,7 +47,7 @@ public:
};
// 控制窗口属性
// 窗口控制
class Window
{
friend Game;
@ -142,7 +143,7 @@ private:
};
// 控制游戏时间
// 时间控制
class Time
{
friend Game;
@ -181,7 +182,7 @@ private:
};
// 控制键盘和鼠标的输入
// 输入控制
class Input
{
friend Game;

View File

@ -142,22 +142,6 @@ public:
Node * node
);
// 创建一个默认矩形碰撞体
static ColliderRect * create();
// 根据左上角坐标和宽高创建矩形碰撞体
static ColliderRect * create(
double x,
double y,
double width,
double height
);
// 创建一个和节点位置大小相同的矩形碰撞体
static ColliderRect * create(
Node * node
);
virtual ~ColliderRect();
// 修改矩形碰撞体大小
@ -196,20 +180,6 @@ public:
Node * node
);
// 创建一个默认圆形碰撞体
static ColliderCircle * create();
// 根据圆心和半径创建圆形碰撞体
static ColliderCircle * create(
Point center,
double radius
);
// 创建一个和节点位置大小相同的圆形碰撞体
static ColliderCircle * create(
Node * node
);
virtual ~ColliderCircle();
// 修改圆形碰撞体大小
@ -247,21 +217,6 @@ public:
Node * node
);
// 创建一个默认椭圆碰撞体
static ColliderEllipse * create();
// 根据圆心和半径创建椭圆碰撞体
static ColliderEllipse * create(
Point center,
double radiusX,
double radiusY
);
// 创建一个和节点位置大小相同的椭圆碰撞体
static ColliderEllipse * create(
Node * node
);
virtual ~ColliderEllipse();
// 修改椭圆碰撞体大小

View File

@ -410,39 +410,6 @@ public:
double cropHeight /* 裁剪高度 */
);
// 创建一个空的图片对象
static Image * create();
// 加载图片文件
static Image * create(
const String& filePath /* 图片文件路径 */
);
// 加载图片资源
static Image * create(
int resNameId, /* 图片资源名称 */
const String& resType /* 图片资源类型 */
);
// 加载图片文件并裁剪
static Image * create(
const String& filePath, /* 图片文件路径 */
double cropX, /* 裁剪位置 X 坐标 */
double cropY, /* 裁剪位置 Y 坐标 */
double cropWidth, /* 裁剪宽度 */
double cropHeight /* 裁剪高度 */
);
// 加载图片资源并裁剪
static Image * create(
int resNameId, /* 图片资源名称 */
const String& resType, /* 图片资源类型 */
double cropX, /* 裁剪位置 X 坐标 */
double cropY, /* 裁剪位置 Y 坐标 */
double cropWidth, /* 裁剪宽度 */
double cropHeight /* 裁剪高度 */
);
virtual ~Image();
// 加载图片文件
@ -537,9 +504,6 @@ class Scene :
public:
Scene();
// 创建场景
static Scene * create();
virtual ~Scene();
// 重写这个函数,它将在进入这个场景时自动执行

View File

@ -40,9 +40,6 @@ public:
public:
Node();
// 创建空节点
static Node * create();
virtual ~Node();
// 更新节点
@ -522,44 +519,6 @@ public:
double height
);
// 创建一个空精灵
static Sprite * create();
// 从 Image 对象创建精灵
static Sprite * create(
Image * image
);
// 加载图片文件
static Sprite * create(
const String& filePath /* 图片文件路径 */
);
// 加载图片资源
static Sprite * create(
int resNameId, /* 图片资源名称 */
const String& resType /* 图片资源类型 */
);
// 加载图片文件
static Sprite * create(
const String& filePath, /* 图片文件路径 */
double x,
double y,
double width,
double height
);
// 加载图片资源
static Sprite * create(
int resNameId, /* 图片资源名称 */
const String& resType, /* 图片资源类型 */
double x,
double y,
double width,
double height
);
virtual ~Sprite();
// 加载图片文件
@ -693,14 +652,6 @@ public:
const Style& style = Style() /* 文本样式 */
);
static Text * create();
static Text * create(
const String& text, /* 文字内容 */
const Font& font = Font(), /* 字体 */
const Style& style = Style() /* 文本样式 */
);
virtual ~Text();
// 获取文本
@ -892,39 +843,6 @@ public:
const Function& func = nullptr /* 按钮点击后的执行函数 */
);
// 创建一个空按钮
static Button * create();
// 创建按钮
static Button * create(
Node * normal, /* 普通状态 */
const Function& func = nullptr /* 按钮点击后的执行函数 */
);
// 创建按钮
static Button * create(
Node * normal, /* 普通状态 */
Node * selected, /* 鼠标按下状态 */
const Function& func = nullptr /* 按钮点击后的执行函数 */
);
// 创建按钮
static Button * create(
Node * normal, /* 普通状态 */
Node * mouseover, /* 鼠标移入状态 */
Node * selected, /* 鼠标按下状态 */
const Function& func = nullptr /* 按钮点击后的执行函数 */
);
// 创建按钮
static Button * create(
Node * normal, /* 普通状态 */
Node * mouseover, /* 鼠标移入状态 */
Node * selected, /* 鼠标移入状态 */
Node * disabled, /* 按钮禁用状态 */
const Function& func = nullptr /* 按钮点击后的执行函数 */
);
// 获取按钮状态是启用还是禁用
bool isEnable() const;
@ -1028,49 +946,6 @@ public:
const Function& func = nullptr /* 按钮点击后的执行函数 */
);
// 创建一个空的开关按钮
static ButtonToggle * create();
// 创建开关按钮
static ButtonToggle * create(
Node * onNormal, /* 按钮打开时,普通状态 */
Node * offNormal, /* 按钮关闭时,普通状态 */
const Function& func = nullptr /* 按钮点击后的执行函数 */
);
// 创建开关按钮
static ButtonToggle * create(
Node * onNormal, /* 按钮打开时,普通状态 */
Node * offNormal, /* 按钮关闭时,普通状态 */
Node * onSelected, /* 按钮打开时,鼠标按下状态 */
Node * offSelected, /* 按钮关闭时,鼠标按下状态 */
const Function& func = nullptr /* 按钮点击后的执行函数 */
);
// 创建开关按钮
static ButtonToggle * create(
Node * onNormal, /* 按钮打开时,普通状态 */
Node * offNormal, /* 按钮关闭时,普通状态 */
Node * onMouseOver, /* 按钮打开时,鼠标移入状态 */
Node * offMouseOver, /* 按钮关闭时,鼠标移入状态 */
Node * onSelected, /* 按钮打开时,鼠标按下状态 */
Node * offSelected, /* 按钮关闭时,鼠标按下状态 */
const Function& func = nullptr /* 按钮点击后的执行函数 */
);
// 创建开关按钮
static ButtonToggle * create(
Node * onNormal, /* 按钮打开时,普通状态 */
Node * offNormal, /* 按钮关闭时,普通状态 */
Node * onMouseOver, /* 按钮打开时,鼠标移入状态 */
Node * offMouseOver, /* 按钮关闭时,鼠标移入状态 */
Node * onSelected, /* 按钮打开时,鼠标按下状态 */
Node * offSelected, /* 按钮关闭时,鼠标按下状态 */
Node * onDisabled, /* 按钮打开时,禁用状态 */
Node * offDisabled, /* 按钮关闭时,禁用状态 */
const Function& func = nullptr /* 按钮点击后的执行函数 */
);
// 获取开关状态(打开或关闭)
bool getState() const;
@ -1145,14 +1020,6 @@ public:
const std::vector<Button*>& buttons /* 按钮数组 */
);
// 创建空菜单
static Menu * create();
// 创建菜单
static Menu * create(
const std::vector<Button*>& buttons /* 按钮数组 */
);
// 获取菜单是否禁用
bool isEnable() const;

View File

@ -87,17 +87,6 @@ public:
Size size /* 宽度和高度 */
);
static Rect * create();
static Rect * create(
Size size /* 宽度和高度 */
);
static Rect * create(
Point topLeft, /* 左上角坐标 */
Size size /* 宽度和高度 */
);
virtual ~Rect();
protected:
@ -129,21 +118,6 @@ public:
double radiusY /* 圆角半径 */
);
static RoundRect * create();
static RoundRect * create(
Size size, /* 宽度和高度 */
double radiusX, /* 圆角半径 */
double radiusY /* 圆角半径 */
);
static RoundRect * create(
Point topLeft, /* 左上角坐标 */
Size size, /* 宽度和高度 */
double radiusX, /* 圆角半径 */
double radiusY /* 圆角半径 */
);
virtual ~RoundRect();
// 获取圆角半径
@ -191,17 +165,6 @@ public:
double radius /* 半径 */
);
static Circle * create();
static Circle * create(
double radius /* 半径 */
);
static Circle * create(
Point center, /* 圆心坐标 */
double radius /* 半径 */
);
virtual ~Circle();
// 获取半径
@ -242,19 +205,6 @@ public:
double radiusY /* 纵轴半径 */
);
static Ellipse * create();
static Ellipse * create(
double radiusX, /* 横轴半径 */
double radiusY /* 纵轴半径 */
);
static Ellipse * create(
Point center, /* 圆心坐标 */
double radiusX, /* 横轴半径 */
double radiusY /* 纵轴半径 */
);
virtual ~Ellipse();
// 获取横轴半径

View File

@ -70,20 +70,6 @@ public:
virtual ~Music();
// 눼쉔稜있뚤蹶
static Music * create();
// 눼쉔稜있뚤蹶
static Music * create(
const e2d::String& filePath /* 稜있匡숭쨌쓺 */
);
// 눼쉔稜있뚤蹶
static Music * create(
int resNameId, /* 稜있栗都츰냔 */
const String& resType /* 稜있栗都잚謹 */
);
// 打开音乐文件
bool open(
const e2d::String& filePath /* 音乐文件路径 */

View File

@ -75,17 +75,6 @@ public:
double fadeInDuration /* 后一场景淡入动作持续时长 */
);
// 创建淡入淡出式的场景切换动作
static TransitionFade * create(
double duration /* 动作持续时长 */
);
// 创建淡入淡出式的场景切换动作
static TransitionFade * create(
double fadeOutDuration, /* 前一场景淡出动作持续时长 */
double fadeInDuration /* 后一场景淡入动作持续时长 */
);
protected:
// 更新动作
virtual void _updateCustom() override;
@ -112,11 +101,6 @@ public:
double duration /* 浮现动作持续时长 */
);
// 创建浮现式的场景切换动作
static TransitionEmerge * create(
double duration /* 浮现动作持续时长 */
);
protected:
// 更新动作
virtual void _updateCustom() override;
@ -139,12 +123,6 @@ public:
Direction direction = Direction::LEFT /* 场景移动方向 */
);
// 创建移动式的场景切换动作
static TransitionMove * create(
double moveDuration, /* 场景移动动作持续时长 */
Direction direction = Direction::LEFT /* 场景移动方向 */
);
protected:
// 更新动作
virtual void _updateCustom() override;