diff --git a/Easy2D/Action/Action.cpp b/Easy2D/Action/Action.cpp new file mode 100644 index 00000000..91704188 --- /dev/null +++ b/Easy2D/Action/Action.cpp @@ -0,0 +1,84 @@ +#include "..\eactions.h" + +e2d::EAction::EAction() : + m_bRunning(true), + m_bWaiting(false), + m_bEnding(false), + m_bInit(false), + m_pTarget(nullptr), + m_pParentScene(nullptr) +{ + // 默认动作 15ms 运行一次 + setInterval(15); +} + +e2d::EAction::~EAction() +{ +} + +bool e2d::EAction::isRunning() +{ + return m_bRunning && !m_bWaiting; +} + +bool e2d::EAction::isEnding() +{ + return m_bEnding; +} + +void e2d::EAction::start() +{ + m_bRunning = true; +} + +void e2d::EAction::resume() +{ + m_bRunning = true; +} + +void e2d::EAction::pause() +{ + m_bRunning = false; +} + +void e2d::EAction::stop() +{ + m_bEnding = true; +} +void e2d::EAction::wait() +{ + m_bWaiting = true; +} + +void e2d::EAction::notify() +{ + m_bWaiting = false; +} + +void e2d::EAction::setInterval(LONGLONG milliSeconds) +{ + // 设置动作的时间间隔 + m_nAnimationInterval = milliSeconds; +} + +e2d::EAction * e2d::EAction::reverse() const +{ + assert(0); + return nullptr; +} + +e2d::ENode * e2d::EAction::getTarget() +{ + return m_pTarget; +} + +void e2d::EAction::_init() +{ + m_bInit = true; +} + +void e2d::EAction::_reset() +{ + m_bInit = false; + m_bEnding = false; +} diff --git a/Easy2D/Action/ActionCallback.cpp b/Easy2D/Action/ActionCallback.cpp new file mode 100644 index 00000000..b82a65c1 --- /dev/null +++ b/Easy2D/Action/ActionCallback.cpp @@ -0,0 +1,31 @@ +#include "..\eactions.h" + +e2d::ActionCallback::ActionCallback(const std::function& callback) : + m_Callback(callback) +{ +} + +e2d::ActionCallback::~ActionCallback() +{ +} + +e2d::ActionCallback * e2d::ActionCallback::copy() const +{ + return new ActionCallback(m_Callback); +} + +void e2d::ActionCallback::_init() +{ + EAction::_init(); +} + +void e2d::ActionCallback::_exec() +{ + m_Callback(); + this->stop(); +} + +void e2d::ActionCallback::_reset() +{ + EAction::_reset(); +} diff --git a/Easy2D/Action/ActionDelay.cpp b/Easy2D/Action/ActionDelay.cpp new file mode 100644 index 00000000..651c155b --- /dev/null +++ b/Easy2D/Action/ActionDelay.cpp @@ -0,0 +1,39 @@ +#include "..\eactions.h" +#include "..\Win\winbase.h" + +e2d::ActionDelay::ActionDelay(float duration) +{ + setInterval(LONGLONG(duration * 1000)); +} + +e2d::ActionDelay::~ActionDelay() +{ +} + +e2d::ActionDelay * e2d::ActionDelay::copy() const +{ + return new ActionDelay(m_nAnimationInterval / 1000.0f); +} + +void e2d::ActionDelay::_init() +{ + EAction::_init(); + // 记录当前时间 + m_nLast = GetNow(); +} + +void e2d::ActionDelay::_exec() +{ + // 判断时间间隔是否足够 + if (GetInterval(m_nLast) > m_nAnimationInterval) + { + this->stop(); + } +} + +void e2d::ActionDelay::_reset() +{ + EAction::_reset(); + // 记录当前时间 + m_nLast = GetNow(); +} diff --git a/Easy2D/Action/ActionFrames.cpp b/Easy2D/Action/ActionFrames.cpp new file mode 100644 index 00000000..d040bbe5 --- /dev/null +++ b/Easy2D/Action/ActionFrames.cpp @@ -0,0 +1,83 @@ +#include "..\eactions.h" +#include "..\Win\winbase.h" + +e2d::ActionFrames::ActionFrames() : + m_nFrameIndex(0) +{ + // 帧动画默认 .5s 刷新一次 + setInterval(500); +} + +e2d::ActionFrames::ActionFrames(LONGLONG frameDelay) : + m_nFrameIndex(0) +{ + setInterval(frameDelay); +} + +e2d::ActionFrames::~ActionFrames() +{ + for (auto frame : m_vFrames) + { + frame->autoRelease(); + frame->release(); + } +} + +void e2d::ActionFrames::_init() +{ + EAction::_init(); + // 记录当前时间 + m_nLast = GetNow(); +} + +void e2d::ActionFrames::_exec() +{ + // 判断时间间隔是否足够 + while (GetInterval(m_nLast) > m_nAnimationInterval) + { + // 重新记录时间 + m_nLast += milliseconds(m_nAnimationInterval); + m_pTarget->setImage(m_vFrames[m_nFrameIndex]); + m_nFrameIndex++; + // 判断动作是否结束 + if (m_nFrameIndex == m_vFrames.size()) + { + this->stop(); + break; + } + } +} + +void e2d::ActionFrames::_reset() +{ + EAction::_reset(); + m_nFrameIndex = 0; + // 记录当前时间 + m_nLast = steady_clock::now(); +} + +void e2d::ActionFrames::addFrame(Image * frame) +{ + if (frame) + { + m_vFrames.push_back(frame); + frame->retain(); + } +} + +e2d::ActionFrames * e2d::ActionFrames::copy() const +{ + auto a = new ActionFrames(this->m_nAnimationInterval); + for (auto f : m_vFrames) + { + a->addFrame(f); + } + return a; +} + +e2d::ActionFrames * e2d::ActionFrames::reverse() const +{ + auto a = this->copy(); + a->m_vFrames.reserve(m_vFrames.size()); + return a; +} diff --git a/Easy2D/Action/ActionMoveBy.cpp b/Easy2D/Action/ActionMoveBy.cpp new file mode 100644 index 00000000..9cc52699 --- /dev/null +++ b/Easy2D/Action/ActionMoveBy.cpp @@ -0,0 +1,53 @@ +#include "..\eactions.h" + + +e2d::ActionMoveBy::ActionMoveBy(float duration, EVec vector) : + Animation(duration) +{ + m_MoveVector = vector; +} + +e2d::ActionMoveBy::~ActionMoveBy() +{ +} + +void e2d::ActionMoveBy::_init() +{ + Animation::_init(); + m_BeginPos = m_pTarget->getPos(); +} + +void e2d::ActionMoveBy::_exec() +{ + while (Animation::_isDelayEnough()) + { + // 计算移动位置 + float scale = static_cast(m_nDuration) / m_nTotalDuration; + // 移动 Sprite + m_pTarget->setPos( + m_BeginPos.x + m_MoveVector.x * scale, + m_BeginPos.y + m_MoveVector.y * scale + ); + // 判断动作是否结束 + if (_isEnd()) + { + this->stop(); + break; + } + } +} + +void e2d::ActionMoveBy::_reset() +{ + Animation::_reset(); +} + +e2d::ActionMoveBy * e2d::ActionMoveBy::copy() const +{ + return new ActionMoveBy(m_nAnimationInterval / 1000.0f, m_MoveVector); +} + +e2d::ActionMoveBy * e2d::ActionMoveBy::reverse() const +{ + return new ActionMoveBy(m_nTotalDuration / 1000.0f, EVec(-m_MoveVector.x, -m_MoveVector.y)); +} \ No newline at end of file diff --git a/Easy2D/Action/ActionMoveTo.cpp b/Easy2D/Action/ActionMoveTo.cpp new file mode 100644 index 00000000..213d3547 --- /dev/null +++ b/Easy2D/Action/ActionMoveTo.cpp @@ -0,0 +1,27 @@ +#include "..\eactions.h" + +e2d::ActionMoveTo::ActionMoveTo(float duration, EPoint pos) : + ActionMoveBy(duration, EVec()) +{ + m_EndPos = pos; +} + +e2d::ActionMoveTo::~ActionMoveTo() +{ +} + +e2d::ActionMoveTo * e2d::ActionMoveTo::copy() const +{ + return new ActionMoveTo(m_nAnimationInterval / 1000.0f, m_EndPos); +} + +void e2d::ActionMoveTo::_init() +{ + ActionMoveBy::_init(); + m_MoveVector = m_EndPos - m_BeginPos; +} + +void e2d::ActionMoveTo::_reset() +{ + ActionMoveBy::_reset(); +} diff --git a/Easy2D/Action/ActionNeverStop.cpp b/Easy2D/Action/ActionNeverStop.cpp new file mode 100644 index 00000000..3f41d707 --- /dev/null +++ b/Easy2D/Action/ActionNeverStop.cpp @@ -0,0 +1,39 @@ +#include "..\eactions.h" + +e2d::ActionNeverStop::ActionNeverStop(EAction * action) : + m_Action(action) +{ + m_Action->retain(); +} + +e2d::ActionNeverStop::~ActionNeverStop() +{ + SafeRelease(&m_Action); +} + +e2d::ActionNeverStop * e2d::ActionNeverStop::copy() const +{ + return new ActionNeverStop(m_Action->copy()); +} + +void e2d::ActionNeverStop::_init() +{ + EAction::_init(); + m_Action->m_pTarget = m_pTarget; + m_Action->_init(); +} + +void e2d::ActionNeverStop::_exec() +{ + m_Action->_exec(); + + if (m_Action->isEnding()) + { + m_Action->_reset(); + } +} + +void e2d::ActionNeverStop::_reset() +{ + EAction::_reset(); +} diff --git a/Easy2D/Action/ActionOpacityBy.cpp b/Easy2D/Action/ActionOpacityBy.cpp new file mode 100644 index 00000000..d6db737f --- /dev/null +++ b/Easy2D/Action/ActionOpacityBy.cpp @@ -0,0 +1,50 @@ +#include "..\eactions.h" + + +e2d::ActionOpacityBy::ActionOpacityBy(float duration, float opacity) : + Animation(duration) +{ + m_nVariation = opacity; +} + +e2d::ActionOpacityBy::~ActionOpacityBy() +{ +} + +void e2d::ActionOpacityBy::_init() +{ + Animation::_init(); + m_nBeginVal = m_pTarget->getOpacity(); +} + +void e2d::ActionOpacityBy::_exec() +{ + while (Animation::_isDelayEnough()) + { + // 计算移动位置 + float scale = static_cast(m_nDuration) / m_nTotalDuration; + // 移动 Sprite + m_pTarget->setOpacity(m_nBeginVal + m_nVariation * scale); + // 判断动作是否结束 + if (_isEnd()) + { + this->stop(); + break; + } + } +} + +void e2d::ActionOpacityBy::_reset() +{ + Animation::_reset(); +} + +e2d::ActionOpacityBy * e2d::ActionOpacityBy::copy() const +{ + return new ActionOpacityBy(m_nAnimationInterval / 1000.0f, m_nVariation); +} + +e2d::ActionOpacityBy * e2d::ActionOpacityBy::reverse() const +{ + return new ActionOpacityBy(m_nTotalDuration / 1000.0f, -m_nVariation); +} \ No newline at end of file diff --git a/Easy2D/Action/ActionOpacityTo.cpp b/Easy2D/Action/ActionOpacityTo.cpp new file mode 100644 index 00000000..5cb5db5c --- /dev/null +++ b/Easy2D/Action/ActionOpacityTo.cpp @@ -0,0 +1,28 @@ +#include "..\eactions.h" + + +e2d::ActionOpacityTo::ActionOpacityTo(float duration, float opacity) : + ActionOpacityBy(duration, 0) +{ + m_nEndVal = opacity; +} + +e2d::ActionOpacityTo::~ActionOpacityTo() +{ +} + +e2d::ActionOpacityTo * e2d::ActionOpacityTo::copy() const +{ + return new ActionOpacityTo(m_nAnimationInterval / 1000.0f, m_nEndVal); +} + +void e2d::ActionOpacityTo::_init() +{ + ActionOpacityBy::_init(); + m_nVariation = m_nEndVal - m_nBeginVal; +} + +void e2d::ActionOpacityTo::_reset() +{ + ActionOpacityBy::_reset(); +} diff --git a/Easy2D/Action/ActionScaleBy.cpp b/Easy2D/Action/ActionScaleBy.cpp new file mode 100644 index 00000000..6ae1a7fd --- /dev/null +++ b/Easy2D/Action/ActionScaleBy.cpp @@ -0,0 +1,52 @@ +#include "..\eactions.h" + + +e2d::ActionScaleBy::ActionScaleBy(float duration, float scaleX, float scaleY) : + Animation(duration) +{ + m_nVariationX = scaleX; + m_nVariationY = scaleY; +} + +e2d::ActionScaleBy::~ActionScaleBy() +{ +} + +void e2d::ActionScaleBy::_init() +{ + Animation::_init(); + m_nBeginScaleX = m_pTarget->getScaleX(); + m_nBeginScaleY = m_pTarget->getScaleY(); +} + +void e2d::ActionScaleBy::_exec() +{ + while (Animation::_isDelayEnough()) + { + // 计算移动位置 + float scale = static_cast(m_nDuration) / m_nTotalDuration; + // 移动 Sprite + m_pTarget->setScale(m_nBeginScaleX + m_nVariationX * scale, m_nBeginScaleX + m_nVariationX * scale); + // 判断动作是否结束 + if (_isEnd()) + { + this->stop(); + break; + } + } +} + +void e2d::ActionScaleBy::_reset() +{ + Animation::_reset(); +} + +e2d::ActionScaleBy * e2d::ActionScaleBy::copy() const +{ + return new ActionScaleBy(m_nAnimationInterval / 1000.0f, m_nVariationX, m_nVariationY); +} + +e2d::ActionScaleBy * e2d::ActionScaleBy::reverse() const +{ + return new ActionScaleBy(m_nTotalDuration / 1000.0f, -m_nVariationX, -m_nVariationY); +} \ No newline at end of file diff --git a/Easy2D/Action/ActionScaleTo.cpp b/Easy2D/Action/ActionScaleTo.cpp new file mode 100644 index 00000000..2b1bc183 --- /dev/null +++ b/Easy2D/Action/ActionScaleTo.cpp @@ -0,0 +1,29 @@ +#include "..\eactions.h" + +e2d::ActionScaleTo::ActionScaleTo(float duration, float scaleX, float scaleY) : + ActionScaleBy(duration, 0, 0) +{ + m_nEndScaleX = scaleX; + m_nEndScaleY = scaleY; +} + +e2d::ActionScaleTo::~ActionScaleTo() +{ +} + +e2d::ActionScaleTo * e2d::ActionScaleTo::copy() const +{ + return new ActionScaleTo(m_nAnimationInterval / 1000.0f, m_nEndScaleX, m_nEndScaleY); +} + +void e2d::ActionScaleTo::_init() +{ + ActionScaleBy::_init(); + m_nVariationX = m_nEndScaleX - m_nBeginScaleX; + m_nVariationY = m_nEndScaleY - m_nBeginScaleY; +} + +void e2d::ActionScaleTo::_reset() +{ + ActionScaleBy::_reset(); +} diff --git a/Easy2D/Action/ActionSequence.cpp b/Easy2D/Action/ActionSequence.cpp new file mode 100644 index 00000000..1ae64d92 --- /dev/null +++ b/Easy2D/Action/ActionSequence.cpp @@ -0,0 +1,105 @@ +#include "..\eactions.h" +#include + +e2d::ActionSequence::ActionSequence() : + m_nActionIndex(0) +{ +} + +e2d::ActionSequence::ActionSequence(int number, EAction * action1, ...) : + m_nActionIndex(0) +{ + va_list params; + va_start(params, number); + + while (number > 0) + { + this->addAction(va_arg(params, EAction*)); + number--; + } + + va_end(params); +} + +e2d::ActionSequence::~ActionSequence() +{ + for (auto action : m_vActions) + { + SafeRelease(&action); + } +} + +void e2d::ActionSequence::_init() +{ + EAction::_init(); + // 将所有动作与目标绑定 + for (auto action : m_vActions) + { + action->m_pTarget = m_pTarget; + } + // 初始化第一个动作 + m_vActions[0]->_init(); +} + +void e2d::ActionSequence::_exec() +{ + m_vActions[m_nActionIndex]->_exec(); + + if (m_vActions[m_nActionIndex]->isEnding()) + { + m_nActionIndex++; + if (m_nActionIndex == m_vActions.size()) + { + this->stop(); + } + else + { + m_vActions[m_nActionIndex]->_init(); + } + } +} + +void e2d::ActionSequence::_reset() +{ + EAction::_reset(); + for (auto action : m_vActions) + { + action->_reset(); + } + m_nActionIndex = 0; +} + +void e2d::ActionSequence::addAction(EAction * action) +{ + m_vActions.push_back(action); + action->retain(); +} + +e2d::ActionSequence * e2d::ActionSequence::copy() const +{ + auto a = new ActionSequence(); + for (auto action : m_vActions) + { + a->addAction(action->copy()); + } + return a; +} + +e2d::ActionSequence * e2d::ActionSequence::reverse(bool actionReverse) const +{ + auto a = new ActionSequence(); + for (auto action : a->m_vActions) + { + if (actionReverse) + { + a->addAction(action->reverse()); + } + else + { + a->addAction(action->copy()); + } + } + // 将动作顺序逆序排列 + a->m_vActions.reserve(m_vActions.size()); + return a; +} \ No newline at end of file diff --git a/Easy2D/Action/ActionTwo.cpp b/Easy2D/Action/ActionTwo.cpp new file mode 100644 index 00000000..6c3df5d5 --- /dev/null +++ b/Easy2D/Action/ActionTwo.cpp @@ -0,0 +1,70 @@ +#include "..\eactions.h" + +e2d::ActionTwo::ActionTwo(EAction * actionFirst, EAction * actionSecond) : + m_FirstAction(actionFirst), + m_SecondAction(actionSecond) +{ + m_FirstAction->retain(); + m_SecondAction->retain(); +} + +e2d::ActionTwo::~ActionTwo() +{ + SafeRelease(&m_FirstAction); + SafeRelease(&m_SecondAction); +} + +e2d::ActionTwo * e2d::ActionTwo::copy() const +{ + return new ActionTwo(m_FirstAction->copy(), m_SecondAction->copy()); +} + +e2d::ActionTwo * e2d::ActionTwo::reverse(bool actionReverse) const +{ + if (actionReverse) + { + return new ActionTwo(m_SecondAction->reverse(), m_FirstAction->reverse()); + } + else + { + return new ActionTwo(m_SecondAction->copy(), m_FirstAction->copy()); + } +} + +void e2d::ActionTwo::_init() +{ + EAction::_init(); + m_FirstAction->m_pTarget = m_pTarget; + m_SecondAction->m_pTarget = m_pTarget; + + m_FirstAction->_init(); +} + +void e2d::ActionTwo::_exec() +{ + if (!m_FirstAction->isEnding()) + { + m_FirstAction->_exec(); + if (m_FirstAction->isEnding()) + { + // 返回 true 表示第一个动作已经结束 + m_SecondAction->_init(); + } + } + else if (!m_SecondAction->isEnding()) + { + m_SecondAction->_exec(); + } + else + { + this->stop(); + } +} + +void e2d::ActionTwo::_reset() +{ + EAction::_reset(); + + m_FirstAction->_reset(); + m_SecondAction->_reset(); +} diff --git a/Easy2D/Action/Animation.cpp b/Easy2D/Action/Animation.cpp new file mode 100644 index 00000000..5b809445 --- /dev/null +++ b/Easy2D/Action/Animation.cpp @@ -0,0 +1,45 @@ +#include "..\eactions.h" +#include "..\Win\winbase.h" + +e2d::Animation::Animation(float duration) +{ + m_nDuration = 0; + m_nTotalDuration = UINT(duration * 1000); +} + +e2d::Animation::~Animation() +{ +} + +bool e2d::Animation::_isEnd() const +{ + return m_nDuration >= m_nTotalDuration; +} + +void e2d::Animation::_init() +{ + EAction::_init(); + // 记录当前时间 + m_nLast = GetNow(); +} + +bool e2d::Animation::_isDelayEnough() +{ + // 判断时间间隔是否足够 + if (GetInterval(m_nLast) > m_nAnimationInterval) + { + // 重新记录时间 + m_nLast += milliseconds(m_nAnimationInterval); + m_nDuration += m_nAnimationInterval; + return true; + } + return false; +} + +void e2d::Animation::_reset() +{ + EAction::_reset(); + m_nDuration = 0; + // 记录当前时间 + m_nLast = GetNow(); +} diff --git a/Easy2D/Base/EApp.cpp b/Easy2D/Base/EApp.cpp index 2e4bb6ef..d144ad3d 100644 --- a/Easy2D/Base/EApp.cpp +++ b/Easy2D/Base/EApp.cpp @@ -37,7 +37,10 @@ e2d::EApp::~EApp() // 释放资源 SafeReleaseInterface(&GetRenderTarget()); SafeReleaseInterface(&GetFactory()); - + SafeReleaseInterface(&GetImagingFactory()); + SafeReleaseInterface(&GetDirectWriteFactory()); + SafeReleaseInterface(&GetSolidColorBrush()); + CoUninitialize(); } @@ -297,9 +300,9 @@ void e2d::EApp::_onControl() // 断言当前场景非空 ASSERT(m_pCurrentScene != nullptr, "Current scene NULL pointer exception."); - ETimerManager::TimerProc(); // 定时器执行程序 - //ActionManager::__exec(); // 动作管理器执行程序 - EObjectManager::__flush(); // 刷新内存池 + ETimerManager::TimerProc(); // 定时器管理器执行程序 + EActionManager::ActionProc(); // 动作管理器执行程序 + EObjectManager::__flush(); // 刷新内存池 } // This method discards device-specific diff --git a/Easy2D/Base/EScene.cpp b/Easy2D/Base/EScene.cpp index cf83b0fd..bc144e5d 100644 --- a/Easy2D/Base/EScene.cpp +++ b/Easy2D/Base/EScene.cpp @@ -51,7 +51,7 @@ void e2d::EScene::_onEnter() ETimerManager::_notifyAllTimersBindedWith(this); EMsgManager::_notifyAllMouseListenersBindedWith(this); EMsgManager::_notifyAllKeyboardListenersBindedWith(this); - //ActionManager::notifyAllSceneActions(m_pNextScene); + EActionManager::_notifyAllActionsBindedWith(this); } void e2d::EScene::_onExit() @@ -61,14 +61,14 @@ void e2d::EScene::_onExit() ETimerManager::_waitAllTimersBindedWith(this); EMsgManager::_waitAllMouseListenersBindedWith(this); EMsgManager::_waitAllKeyboardListenersBindedWith(this); - //ActionManager::waitAllSceneActions(m_pCurrentScene); + EActionManager::_waitAllActionsBindedWith(this); } else { ETimerManager::clearAllTimersBindedWith(this); EMsgManager::clearAllMouseListenersBindedWith(this); EMsgManager::clearAllKeyboardListenersBindedWith(this); - //ActionManager::stopAllSceneActions(m_pCurrentScene); + EActionManager::clearAllActionsBindedWith(this); } } diff --git a/Easy2D/ETimer.cpp b/Easy2D/ETimer.cpp index b98605b6..3b42e30e 100644 --- a/Easy2D/ETimer.cpp +++ b/Easy2D/ETimer.cpp @@ -1,4 +1,5 @@ #include "etools.h" +#include "Win\winbase.h" e2d::ETimer::ETimer() : m_bRunning(false) @@ -43,7 +44,7 @@ bool e2d::ETimer::isWaiting() const void e2d::ETimer::start() { m_bRunning = true; - m_tLast = std::chrono::steady_clock::now(); + m_tLast = GetNow(); } void e2d::ETimer::stop() @@ -59,7 +60,7 @@ void e2d::ETimer::_wait() void e2d::ETimer::_notify() { m_bWaiting = false; - m_tLast = std::chrono::steady_clock::now(); + m_tLast = GetNow(); } e2d::EString e2d::ETimer::getName() const @@ -97,7 +98,7 @@ void e2d::ETimer::bindWith(ENode * pParentNode) ETimerManager::bindTimer(this, pParentNode); } -void e2d::ETimer::_runCallback() +void e2d::ETimer::_callOn() { m_Callback(m_nRunTimes); m_nRunTimes++; diff --git a/Easy2D/Easy2D.vcxproj b/Easy2D/Easy2D.vcxproj index 711ea382..c2c3d273 100644 --- a/Easy2D/Easy2D.vcxproj +++ b/Easy2D/Easy2D.vcxproj @@ -192,6 +192,20 @@ + + + + + + + + + + + + + + @@ -210,11 +224,13 @@ + + diff --git a/Easy2D/Easy2D.vcxproj.filters b/Easy2D/Easy2D.vcxproj.filters index cd427cd4..698ca438 100644 --- a/Easy2D/Easy2D.vcxproj.filters +++ b/Easy2D/Easy2D.vcxproj.filters @@ -19,6 +19,9 @@ {b9bb1728-5106-4574-998e-8564b49cb4a1} + + {50293f38-87fe-4dde-b938-cf1b7a2921f8} + @@ -84,6 +87,51 @@ Node + + Action + + + Action + + + Action + + + Action + + + Action + + + Action + + + Action + + + Action + + + Action + + + Action + + + Action + + + Action + + + Action + + + Action + + + Tool + @@ -96,5 +144,6 @@ + \ No newline at end of file diff --git a/Easy2D/Msg/EMsgManager.cpp b/Easy2D/Msg/EMsgManager.cpp index 0a0a5cd2..b55e9e51 100644 --- a/Easy2D/Msg/EMsgManager.cpp +++ b/Easy2D/Msg/EMsgManager.cpp @@ -129,7 +129,7 @@ void e2d::EMsgManager::MouseProc(UINT message, WPARAM wParam, LPARAM lParam) { if (mlistener->isRunning()) { - mlistener->_runCallback(); + mlistener->_callOn(); } } } @@ -145,7 +145,7 @@ void e2d::EMsgManager::KeyboardProc(UINT message, WPARAM wParam, LPARAM lParam) { if (klistener->isRunning()) { - klistener->_runCallback(); + klistener->_callOn(); } } } diff --git a/Easy2D/Msg/Listener/EKeyboardListener.cpp b/Easy2D/Msg/Listener/EKeyboardListener.cpp index cb362318..61b2a160 100644 --- a/Easy2D/Msg/Listener/EKeyboardListener.cpp +++ b/Easy2D/Msg/Listener/EKeyboardListener.cpp @@ -22,7 +22,7 @@ e2d::EKeyboardListener::EKeyboardListener(const EString & name, const KEY_LISTEN m_Callback = callback; } -void e2d::EKeyboardListener::_runCallback() +void e2d::EKeyboardListener::_callOn() { m_Callback(); } diff --git a/Easy2D/Msg/Listener/EKeyboardPressListener.cpp b/Easy2D/Msg/Listener/EKeyboardPressListener.cpp index 67b3081e..69162bec 100644 --- a/Easy2D/Msg/Listener/EKeyboardPressListener.cpp +++ b/Easy2D/Msg/Listener/EKeyboardPressListener.cpp @@ -20,7 +20,7 @@ e2d::EKeyboardPressListener::EKeyboardPressListener(const EString & name, const { } -void e2d::EKeyboardPressListener::_runCallback() +void e2d::EKeyboardPressListener::_callOn() { if (EKeyboardMsg::getMsg() == EKeyboardMsg::KEYBOARD_MSG::KEY_DOWN) { diff --git a/Easy2D/Msg/Listener/EMouseClickListener.cpp b/Easy2D/Msg/Listener/EMouseClickListener.cpp index ceed23dd..f1b3c861 100644 --- a/Easy2D/Msg/Listener/EMouseClickListener.cpp +++ b/Easy2D/Msg/Listener/EMouseClickListener.cpp @@ -26,7 +26,7 @@ e2d::EMouseClickListener::EMouseClickListener(const EString & name, const MOUSE_ { } -void e2d::EMouseClickListener::_runCallback() +void e2d::EMouseClickListener::_callOn() { if (EMouseMsg::getMsg() == EMouseMsg::LBUTTON_DOWN || EMouseMsg::getMsg() == EMouseMsg::LBUTTON_DBLCLK) diff --git a/Easy2D/Msg/Listener/EMouseDoubleClickListener.cpp b/Easy2D/Msg/Listener/EMouseDoubleClickListener.cpp index 6b92f791..8071f432 100644 --- a/Easy2D/Msg/Listener/EMouseDoubleClickListener.cpp +++ b/Easy2D/Msg/Listener/EMouseDoubleClickListener.cpp @@ -26,7 +26,7 @@ e2d::EMouseDoubleClickListener::EMouseDoubleClickListener(const EString & name, { } -void e2d::EMouseDoubleClickListener::_runCallback() +void e2d::EMouseDoubleClickListener::_callOn() { if (EMouseMsg::getMsg() == EMouseMsg::LBUTTON_DOWN) { diff --git a/Easy2D/Msg/Listener/EMouseDragListener.cpp b/Easy2D/Msg/Listener/EMouseDragListener.cpp index f41ff094..8eac4183 100644 --- a/Easy2D/Msg/Listener/EMouseDragListener.cpp +++ b/Easy2D/Msg/Listener/EMouseDragListener.cpp @@ -22,7 +22,7 @@ e2d::EMouseDragListener::EMouseDragListener(const EString & name, const MOUSE_DR { } -void e2d::EMouseDragListener::_runCallback() +void e2d::EMouseDragListener::_callOn() { if (EMouseMsg::getMsg() == EMouseMsg::LBUTTON_DOWN || EMouseMsg::getMsg() == EMouseMsg::LBUTTON_DBLCLK) diff --git a/Easy2D/Msg/Listener/EMouseListener.cpp b/Easy2D/Msg/Listener/EMouseListener.cpp index 5a4d45aa..90bcc713 100644 --- a/Easy2D/Msg/Listener/EMouseListener.cpp +++ b/Easy2D/Msg/Listener/EMouseListener.cpp @@ -22,7 +22,7 @@ e2d::EMouseListener::EMouseListener(const EString & name, const MOUSE_LISTENER_C m_Callback = callback; } -void e2d::EMouseListener::_runCallback() +void e2d::EMouseListener::_callOn() { m_Callback(); } diff --git a/Easy2D/Msg/Listener/EMousePressListener.cpp b/Easy2D/Msg/Listener/EMousePressListener.cpp index dec9b7fa..81d94344 100644 --- a/Easy2D/Msg/Listener/EMousePressListener.cpp +++ b/Easy2D/Msg/Listener/EMousePressListener.cpp @@ -22,7 +22,7 @@ e2d::EMousePressListener::EMousePressListener(const EString & name, const MOUSE_ { } -void e2d::EMousePressListener::_runCallback() +void e2d::EMousePressListener::_callOn() { if (EMouseMsg::getMsg() == EMouseMsg::LBUTTON_DOWN || EMouseMsg::getMsg() == EMouseMsg::LBUTTON_DBLCLK) diff --git a/Easy2D/Node/ENode.cpp b/Easy2D/Node/ENode.cpp index 25575b7d..ec1e2dfc 100644 --- a/Easy2D/Node/ENode.cpp +++ b/Easy2D/Node/ENode.cpp @@ -1,6 +1,7 @@ #include "..\enodes.h" #include "..\emsg.h" #include "..\etools.h" +#include "..\eactions.h" #include "..\Win\winbase.h" #include @@ -34,6 +35,10 @@ e2d::ENode::ENode(const EString & name) e2d::ENode::~ENode() { + ETimerManager::clearAllTimersBindedWith(this); + EMsgManager::clearAllMouseListenersBindedWith(this); + EMsgManager::clearAllKeyboardListenersBindedWith(this); + EActionManager::clearAllActionsBindedWith(this); } void e2d::ENode::onEnter() @@ -105,6 +110,7 @@ void e2d::ENode::_onEnter() ETimerManager::_notifyAllTimersBindedWith(this); EMsgManager::_notifyAllMouseListenersBindedWith(this); EMsgManager::_notifyAllKeyboardListenersBindedWith(this); + EActionManager::_notifyAllActionsBindedWith(this); this->onEnter(); for (const auto &child : m_vChildren) @@ -123,6 +129,7 @@ void e2d::ENode::_onExit() ETimerManager::_waitAllTimersBindedWith(this); EMsgManager::_waitAllMouseListenersBindedWith(this); EMsgManager::_waitAllKeyboardListenersBindedWith(this); + EActionManager::_waitAllActionsBindedWith(this); this->onExit(); for (const auto &child : m_vChildren) @@ -132,17 +139,6 @@ void e2d::ENode::_onExit() } } -void e2d::ENode::_onClear() -{ - ETimerManager::clearAllTimersBindedWith(this); - EMsgManager::clearAllMouseListenersBindedWith(this); - EMsgManager::clearAllKeyboardListenersBindedWith(this); - for (const auto &child : m_vChildren) - { - child->_onClear(); - } -} - void e2d::ENode::_sortChildren() { if (m_bSortChildrenNeeded) @@ -558,7 +554,7 @@ void e2d::ENode::removeFromParent(bool release /* = false */) } } -bool e2d::ENode::removeChild(ENode * child, bool release /* = false */) +bool e2d::ENode::removeChild(ENode * child, bool release /* = true */) { WARN_IF(child == nullptr, "ENode::removeChild NULL pointer exception."); @@ -591,7 +587,7 @@ bool e2d::ENode::removeChild(ENode * child, bool release /* = false */) return false; } -void e2d::ENode::removeChild(const EString & childName, bool release /* = false */) +void e2d::ENode::removeChild(const EString & childName, bool release /* = true */) { WARN_IF(childName.empty(), "Invalid ENode name."); @@ -625,26 +621,31 @@ void e2d::ENode::removeChild(const EString & childName, bool release /* = false } } -void e2d::ENode::clearAllChildren(bool release /* = false */) +void e2d::ENode::clearAllChildren(bool release /* = true */) { // 所有节点的引用计数减一 for (auto child : m_vChildren) { if (release) { - child->_onClear(); child->autoRelease(); } - else - { - child->_onExit(); - } + child->_onExit(); child->release(); } // 清空储存节点的容器 m_vChildren.clear(); } +void e2d::ENode::runAction(EAction * action) +{ + EActionManager::bindAction(action, this); +} + +void e2d::ENode::stopAction(EAction * action) +{ +} + void e2d::ENode::setVisiable(bool value) { m_bVisiable = value; diff --git a/Easy2D/Node/ESpriteFrame.cpp b/Easy2D/Node/ESpriteFrame.cpp new file mode 100644 index 00000000..6de60dab --- /dev/null +++ b/Easy2D/Node/ESpriteFrame.cpp @@ -0,0 +1 @@ +#include "..\enodes.h" \ No newline at end of file diff --git a/Easy2D/Tool/EActionManager.cpp b/Easy2D/Tool/EActionManager.cpp new file mode 100644 index 00000000..0b635ced --- /dev/null +++ b/Easy2D/Tool/EActionManager.cpp @@ -0,0 +1,62 @@ +#include "..\etools.h" + + +void e2d::EActionManager::bindAction(EAction * action, ENode * pParentNode) +{ +} + +void e2d::EActionManager::startAllActionsBindedWith(EScene * pParentScene) +{ +} + +void e2d::EActionManager::stopAllActionsBindedWith(EScene * pParentScene) +{ +} + +void e2d::EActionManager::clearAllActionsBindedWith(EScene * pParentScene) +{ +} + +void e2d::EActionManager::startAllActionsBindedWith(ENode * pParentNode) +{ +} + +void e2d::EActionManager::stopAllActionsBindedWith(ENode * pParentNode) +{ +} + +void e2d::EActionManager::clearAllActionsBindedWith(ENode * pParentNode) +{ +} + +void e2d::EActionManager::startAllActions() +{ +} + +void e2d::EActionManager::stopAllActions() +{ +} + +void e2d::EActionManager::clearAllActions() +{ +} + +void e2d::EActionManager::_waitAllActionsBindedWith(EScene * pParentScene) +{ +} + +void e2d::EActionManager::_notifyAllActionsBindedWith(EScene * pParentScene) +{ +} + +void e2d::EActionManager::_waitAllActionsBindedWith(ENode * pParentNode) +{ +} + +void e2d::EActionManager::_notifyAllActionsBindedWith(ENode * pParentNode) +{ +} + +void e2d::EActionManager::ActionProc() +{ +} diff --git a/Easy2D/Tool/ETimerManager.cpp b/Easy2D/Tool/ETimerManager.cpp index dfa19f05..f7a0cc77 100644 --- a/Easy2D/Tool/ETimerManager.cpp +++ b/Easy2D/Tool/ETimerManager.cpp @@ -257,7 +257,7 @@ void e2d::ETimerManager::TimerProc() { if (GetInterval(t->m_tLast) >= t->m_nInterval) { - t->_runCallback(); + t->_callOn(); t->m_tLast = GetNow(); } } diff --git a/Easy2D/Win/winbase.cpp b/Easy2D/Win/winbase.cpp index 50d30ac7..9a36412e 100644 --- a/Easy2D/Win/winbase.cpp +++ b/Easy2D/Win/winbase.cpp @@ -1,5 +1,4 @@ #include "winbase.h" -using namespace std::chrono; static HWND s_HWnd = nullptr; diff --git a/Easy2D/Win/winbase.h b/Easy2D/Win/winbase.h index 7256070f..78c1a2a5 100644 --- a/Easy2D/Win/winbase.h +++ b/Easy2D/Win/winbase.h @@ -1,6 +1,7 @@ #pragma once #include "..\emacros.h" #include +using namespace std::chrono; #ifndef HINST_THISCOMPONENT diff --git a/Easy2D/eactions.h b/Easy2D/eactions.h new file mode 100644 index 00000000..b8ab4985 --- /dev/null +++ b/Easy2D/eactions.h @@ -0,0 +1,350 @@ +#pragma once +#include "enodes.h" +#include "etools.h" + +namespace e2d +{ + +class ActionTwo; +class ActionNeverStop; +class ActionSequence; + +class EAction : + public EObject +{ + friend ENode; + friend EActionManager; + friend ActionTwo; + friend ActionNeverStop; + friend ActionSequence; + +public: + EAction(); + + virtual ~EAction(); + + // 获取动作运行状态 + virtual bool isRunning(); + // 获取动作结束状态 + virtual bool isEnding(); + // 继续动作 + virtual void start(); + // 继续动作 + virtual void resume(); + // 暂停动作 + virtual void pause(); + // 停止动作 + virtual void stop(); + // 设置动作每一帧时间间隔 + virtual void setInterval(LONGLONG milliSeconds); + // 获取一个新的拷贝动作 + virtual EAction * copy() const = 0; + // 获取一个新的逆向动作 + virtual EAction * reverse() const; + // 获取执行该动作的目标 + virtual ENode * getTarget(); + +protected: + // 初始化动作 + virtual void _init(); + + // 执行动作 + virtual void _exec() = 0; + + // 重置动作 + virtual void _reset(); + + // 进入等待状态 + virtual void wait(); + + // 唤醒 + virtual void notify(); + +protected: + bool m_bRunning; + bool m_bWaiting; + bool m_bEnding; + bool m_bInit; + ENode * m_pTarget; + EScene * m_pParentScene; + LONGLONG m_nAnimationInterval; + std::chrono::steady_clock::time_point m_nLast; +}; + + +class Animation : + public EAction +{ +public: + Animation(float duration); + virtual ~Animation(); + +protected: + LONGLONG m_nDuration; + LONGLONG m_nTotalDuration; + +protected: + bool _isEnd() const; + bool _isDelayEnough(); + virtual void _init() override; + virtual void _reset() override; +}; + + +class ActionMoveBy : + public Animation +{ +public: + ActionMoveBy(float duration, EVec vector); + virtual ~ActionMoveBy(); + + virtual ActionMoveBy * copy() const override; + virtual ActionMoveBy * reverse() const override; + +protected: + EPoint m_BeginPos; + EVec m_MoveVector; + +protected: + virtual void _init() override; + virtual void _exec() override; + virtual void _reset() override; +}; + + +class ActionMoveTo : + public ActionMoveBy +{ +public: + ActionMoveTo(float duration, EPoint pos); + virtual ~ActionMoveTo(); + + virtual ActionMoveTo * copy() const override; + +protected: + EPoint m_EndPos; + +protected: + virtual void _init() override; + virtual void _reset() override; +}; + + +class ActionScaleBy : + public Animation +{ +public: + ActionScaleBy(float duration, float scaleX, float scaleY); + virtual ~ActionScaleBy(); + + virtual ActionScaleBy * copy() const override; + virtual ActionScaleBy * reverse() const override; + +protected: + float m_nBeginScaleX; + float m_nBeginScaleY; + float m_nVariationX; + float m_nVariationY; + +protected: + virtual void _init() override; + virtual void _exec() override; + virtual void _reset() override; +}; + + +class ActionScaleTo : + public ActionScaleBy +{ +public: + ActionScaleTo(float duration, float scaleX, float scaleY); + virtual ~ActionScaleTo(); + + virtual ActionScaleTo * copy() const override; + +protected: + float m_nEndScaleX; + float m_nEndScaleY; + +protected: + virtual void _init() override; + virtual void _reset() override; +}; + + +class ActionOpacityBy : + public Animation +{ +public: + ActionOpacityBy(float duration, float opacity); + virtual ~ActionOpacityBy(); + + virtual ActionOpacityBy * copy() const override; + virtual ActionOpacityBy * reverse() const override; + +protected: + float m_nBeginVal; + float m_nVariation; + +protected: + virtual void _init() override; + virtual void _exec() override; + virtual void _reset() override; +}; + + +class ActionOpacityTo : + public ActionOpacityBy +{ +public: + ActionOpacityTo(float duration, float opacity); + virtual ~ActionOpacityTo(); + + virtual ActionOpacityTo * copy() const override; + +protected: + float m_nEndVal; + +protected: + virtual void _init() override; + virtual void _reset() override; +}; + + +class ActionFadeIn : + public ActionOpacityTo +{ +public: + ActionFadeIn(float duration) : ActionOpacityTo(duration, 1) {} +}; + + +class ActionFadeOut : + public ActionOpacityTo +{ +public: + ActionFadeOut(float duration) : ActionOpacityTo(duration, 0) {} +}; + + +class ActionTwo : + public EAction +{ +public: + ActionTwo(EAction * actionFirst, EAction * actionSecond); + virtual ~ActionTwo(); + + virtual ActionTwo * copy() const override; + virtual ActionTwo * reverse(bool actionReverse = true) const; + +protected: + EAction * m_FirstAction; + EAction * m_SecondAction; + +protected: + virtual void _init() override; + virtual void _exec() override; + virtual void _reset() override; +}; + + +class ActionSequence : + public EAction +{ +public: + ActionSequence(); + ActionSequence(int number, EAction * action1, ...); + virtual ~ActionSequence(); + + void addAction(EAction * action); + virtual ActionSequence * copy() const override; + virtual ActionSequence * reverse(bool actionReverse = true) const; + +protected: + UINT m_nActionIndex; + std::vector m_vActions; + +protected: + virtual void _init() override; + virtual void _exec() override; + virtual void _reset() override; +}; + + +class ActionDelay : + public EAction +{ +public: + ActionDelay(float duration); + virtual ~ActionDelay(); + + virtual ActionDelay * copy() const override; + +protected: + virtual void _init() override; + virtual void _exec() override; + virtual void _reset() override; +}; + + +class ActionNeverStop : + public EAction +{ +public: + ActionNeverStop(EAction * action); + virtual ~ActionNeverStop(); + + virtual ActionNeverStop * copy() const override; + +protected: + EAction * m_Action; + +protected: + virtual void _init() override; + virtual void _exec() override; + virtual void _reset() override; +}; + + +class ActionFrames : + public EAction +{ +public: + ActionFrames(); + ActionFrames(LONGLONG frameDelay); + ~ActionFrames(); + + void addFrame(Image * frame); + virtual ActionFrames * copy() const override; + virtual ActionFrames * reverse() const override; + +protected: + UINT m_nFrameIndex; + EVector m_vFrames; + +protected: + virtual void _init() override; + virtual void _exec() override; + virtual void _reset() override; +}; + + +class ActionCallback : + public EAction +{ +public: + ActionCallback(const std::function& callback); + ~ActionCallback(); + + virtual ActionCallback * copy() const override; + +protected: + std::function m_Callback; + +protected: + virtual void _init() override; + virtual void _exec() override; + virtual void _reset() override; +}; + +} \ No newline at end of file diff --git a/Easy2D/easy2d.h b/Easy2D/easy2d.h index 25f866e4..6c8486ae 100644 --- a/Easy2D/easy2d.h +++ b/Easy2D/easy2d.h @@ -22,6 +22,7 @@ #include "enodes.h" #include "emsg.h" #include "etools.h" +#include "eactions.h" #if defined(DEBUG) || defined(_DEBUG) diff --git a/Easy2D/ebase.h b/Easy2D/ebase.h index eb72e5da..604f54d4 100644 --- a/Easy2D/ebase.h +++ b/Easy2D/ebase.h @@ -19,7 +19,7 @@ class EApp public: EApp(); - ~EApp(); + virtual ~EApp(); // 初始化游戏界面 bool init( @@ -193,7 +193,7 @@ class EScene public: EScene(); - ~EScene(); + virtual ~EScene(); // 重写这个函数,它将在进入这个场景时自动执行 virtual void onEnter(); diff --git a/Easy2D/emsg.h b/Easy2D/emsg.h index 166a979e..688ae077 100644 --- a/Easy2D/emsg.h +++ b/Easy2D/emsg.h @@ -194,7 +194,7 @@ protected: void _notify(); // 执行监听器回调函数 - virtual void _runCallback() = 0; + virtual void _callOn() = 0; protected: EString m_sName; @@ -244,7 +244,7 @@ public: protected: // 执行监听器回调函数 - virtual void _runCallback() override; + virtual void _callOn() override; protected: MOUSE_LISTENER_CALLBACK m_Callback; @@ -278,7 +278,7 @@ public: protected: // 执行监听器回调函数 - virtual void _runCallback() override; + virtual void _callOn() override; protected: MOUSE_PRESS_LISTENER_CALLBACK m_Callback; @@ -312,7 +312,7 @@ public: protected: // 执行监听器回调函数 - virtual void _runCallback() override; + virtual void _callOn() override; protected: bool m_bPressed; @@ -347,7 +347,7 @@ public: protected: // 执行监听器回调函数 - virtual void _runCallback() override; + virtual void _callOn() override; protected: bool m_bPressed; @@ -382,7 +382,7 @@ public: protected: // 执行监听器回调函数 - virtual void _runCallback() override; + virtual void _callOn() override; protected: EPoint m_Begin; @@ -429,7 +429,7 @@ public: protected: // 执行监听器回调函数 - virtual void _runCallback() override; + virtual void _callOn() override; protected: KEY_LISTENER_CALLBACK m_Callback; @@ -460,7 +460,7 @@ public: protected: // 执行监听器回调函数 - virtual void _runCallback() override; + virtual void _callOn() override; }; diff --git a/Easy2D/enodes.h b/Easy2D/enodes.h index ab0cd3a6..2e267795 100644 --- a/Easy2D/enodes.h +++ b/Easy2D/enodes.h @@ -6,6 +6,7 @@ namespace e2d class EText; class ESprite; +class EAction; class ENode : public EObject @@ -240,18 +241,28 @@ public: // 移除子节点 virtual bool removeChild( ENode * child, - bool release = false + bool release = true ); // 移除子节点 virtual void removeChild( const EString & childName, - bool release = false + bool release = true ); // 移除所有节点 virtual void clearAllChildren( - bool release = false + bool release = true + ); + + // 执行动画 + virtual void runAction( + EAction * action + ); + + // 停止动画 + virtual void stopAction( + EAction * action ); protected: @@ -267,9 +278,6 @@ protected: // 节点从场景中消失时的执行程序 virtual void _onExit(); - // 节点清除时的执行程序 - virtual void _onClear(); - // 子节点排序 void _sortChildren(); @@ -336,7 +344,7 @@ protected: EScene * m_pParentScene; ENode * m_pParent; D2D1::Matrix3x2F m_Matri; - EVector m_vChildren; + EVector m_vChildren; }; @@ -360,7 +368,7 @@ public: const EString & resourceType ); - ~ETexture(); + virtual ~ETexture(); // 从本地文件中读取资源 void loadFromFile( @@ -441,7 +449,7 @@ public: float height ); - ~ESprite(); + virtual ~ESprite(); // 设置精灵纹理 void setTexture( @@ -491,7 +499,7 @@ public: bool italic = false ); - ~EFont(); + virtual ~EFont(); // 获取当前字号 float getFontSize() const; @@ -568,7 +576,7 @@ public: bool italic = false ); - ~EText(); + virtual ~EText(); // 获取文本 EString getText() const; diff --git a/Easy2D/etools.h b/Easy2D/etools.h index eff1e6c1..c24fe24c 100644 --- a/Easy2D/etools.h +++ b/Easy2D/etools.h @@ -6,6 +6,7 @@ namespace e2d { class ETimerManager; +class EAction; // 对象管理器 class EObjectManager @@ -103,7 +104,7 @@ protected: void _notify(); // 执行回调函数 - virtual void _runCallback(); + virtual void _callOn(); protected: EString m_sName; @@ -217,4 +218,83 @@ private: static void TimerProc(); }; + +// 动作管理器 +class EActionManager +{ + friend EApp; + friend EScene; + friend ENode; + +public: + // 绑定动作到节点 + static void bindAction( + EAction * action, + ENode * pParentNode + ); + + // 启动绑定在场景子节点上的所有动作 + static void startAllActionsBindedWith( + EScene * pParentScene + ); + + // 停止绑定在场景子节点上的所有动作 + static void stopAllActionsBindedWith( + EScene * pParentScene + ); + + // 清空绑定在场景子节点上的所有动作 + static void clearAllActionsBindedWith( + EScene * pParentScene + ); + + // 启动绑定在节点上的所有动作 + static void startAllActionsBindedWith( + ENode * pParentNode + ); + + // 停止绑定在节点上的所有动作 + static void stopAllActionsBindedWith( + ENode * pParentNode + ); + + // 清空绑定在节点上的所有动作 + static void clearAllActionsBindedWith( + ENode * pParentNode + ); + + // 启动所有动作 + static void startAllActions(); + + // 停止所有动作 + static void stopAllActions(); + + // 清除所有动作 + static void clearAllActions(); + +private: + // 挂起绑定在场景子节点上的所有动作 + static void _waitAllActionsBindedWith( + EScene * pParentScene + ); + + // 重启绑定在场景子节点上的所有动作 + static void _notifyAllActionsBindedWith( + EScene * pParentScene + ); + + // 挂起绑定在节点上的所有动作 + static void _waitAllActionsBindedWith( + ENode * pParentNode + ); + + // 重启绑定在节点上的所有动作 + static void _notifyAllActionsBindedWith( + ENode * pParentNode + ); + + // 动作执行程序 + static void ActionProc(); +}; + } \ No newline at end of file