diff --git a/projects/kiwano/kiwano.vcxproj b/projects/kiwano/kiwano.vcxproj index 46c98312..d872159e 100644 --- a/projects/kiwano/kiwano.vcxproj +++ b/projects/kiwano/kiwano.vcxproj @@ -5,7 +5,7 @@ - + @@ -99,7 +99,7 @@ - + @@ -109,7 +109,7 @@ - + @@ -175,7 +175,7 @@ - + diff --git a/projects/kiwano/kiwano.vcxproj.filters b/projects/kiwano/kiwano.vcxproj.filters index 8e32b171..43387c70 100644 --- a/projects/kiwano/kiwano.vcxproj.filters +++ b/projects/kiwano/kiwano.vcxproj.filters @@ -90,9 +90,6 @@ 2d\action - - 2d\action - 2d\action @@ -324,9 +321,6 @@ utils - - utils - utils @@ -336,6 +330,12 @@ utils + + utils + + + 2d\action + @@ -377,9 +377,6 @@ 2d\action - - 2d\action - 2d\action @@ -548,15 +545,18 @@ utils - - utils - utils utils + + utils + + + 2d\action + diff --git a/src/kiwano/2d/Actor.cpp b/src/kiwano/2d/Actor.cpp index 6e9a0340..85cc83c3 100644 --- a/src/kiwano/2d/Actor.cpp +++ b/src/kiwano/2d/Actor.cpp @@ -77,9 +77,9 @@ Actor::~Actor() void Actor::Update(Duration dt) { - UpdateActions(this, dt); + ActionScheduler::Update(this, dt); + TaskScheduler::Update(dt); UpdateComponents(dt); - UpdateTasks(dt); if (!update_pausing_) { diff --git a/src/kiwano/2d/Actor.h b/src/kiwano/2d/Actor.h index a1af5e8b..8ebc92d2 100644 --- a/src/kiwano/2d/Actor.h +++ b/src/kiwano/2d/Actor.h @@ -23,8 +23,8 @@ #include #include #include -#include -#include +#include +#include #include namespace kiwano @@ -62,8 +62,8 @@ typedef IntrusiveList ActorList; */ class KGE_API Actor : public ObjectBase - , public TaskManager - , public ActionManager + , public TaskScheduler + , public ActionScheduler , public EventDispatcher , protected IntrusiveListValue { diff --git a/src/kiwano/2d/action/Action.h b/src/kiwano/2d/action/Action.h index f8d79e4a..8bc67bbb 100644 --- a/src/kiwano/2d/action/Action.h +++ b/src/kiwano/2d/action/Action.h @@ -30,7 +30,7 @@ namespace kiwano { class Actor; -class ActionManager; +class ActionScheduler; KGE_DECLARE_SMART_PTR(Action); @@ -55,7 +55,7 @@ class KGE_API Action , public Cloneable , protected IntrusiveListValue { - friend class ActionManager; + friend class ActionScheduler; friend class ActionGroup; friend IntrusiveList; diff --git a/src/kiwano/2d/action/ActionManager.cpp b/src/kiwano/2d/action/ActionScheduler.cpp similarity index 85% rename from src/kiwano/2d/action/ActionManager.cpp rename to src/kiwano/2d/action/ActionScheduler.cpp index 8c79bfe2..4d8b8765 100644 --- a/src/kiwano/2d/action/ActionManager.cpp +++ b/src/kiwano/2d/action/ActionScheduler.cpp @@ -19,12 +19,13 @@ // THE SOFTWARE. #include -#include +#include #include namespace kiwano { -void ActionManager::UpdateActions(Actor* target, Duration dt) + +void ActionScheduler::Update(Actor* target, Duration dt) { if (actions_.IsEmpty() || !target) return; @@ -42,7 +43,7 @@ void ActionManager::UpdateActions(Actor* target, Duration dt) } } -Action* ActionManager::AddAction(ActionPtr action) +Action* ActionScheduler::AddAction(ActionPtr action) { KGE_ASSERT(action && "AddAction failed, NULL pointer exception"); @@ -53,7 +54,7 @@ Action* ActionManager::AddAction(ActionPtr action) return action.Get(); } -void ActionManager::ResumeAllActions() +void ActionScheduler::ResumeAllActions() { if (actions_.IsEmpty()) return; @@ -64,7 +65,7 @@ void ActionManager::ResumeAllActions() } } -void ActionManager::PauseAllActions() +void ActionScheduler::PauseAllActions() { if (actions_.IsEmpty()) return; @@ -75,7 +76,7 @@ void ActionManager::PauseAllActions() } } -void ActionManager::StopAllActions() +void ActionScheduler::StopAllActions() { if (actions_.IsEmpty()) return; @@ -86,7 +87,7 @@ void ActionManager::StopAllActions() } } -ActionPtr ActionManager::GetAction(const String& name) +ActionPtr ActionScheduler::GetAction(const String& name) { if (actions_.IsEmpty()) return nullptr; @@ -97,7 +98,7 @@ ActionPtr ActionManager::GetAction(const String& name) return nullptr; } -const ActionList& ActionManager::GetAllActions() const +const ActionList& ActionScheduler::GetAllActions() const { return actions_; } diff --git a/src/kiwano/2d/action/ActionManager.h b/src/kiwano/2d/action/ActionScheduler.h similarity index 94% rename from src/kiwano/2d/action/ActionManager.h rename to src/kiwano/2d/action/ActionScheduler.h index 841a4611..34d37421 100644 --- a/src/kiwano/2d/action/ActionManager.h +++ b/src/kiwano/2d/action/ActionScheduler.h @@ -30,9 +30,9 @@ namespace kiwano /** * \~chinese - * @brief 动画管理器 + * @brief 动画调度器 */ -class KGE_API ActionManager +class KGE_API ActionScheduler { public: /// \~chinese @@ -60,10 +60,9 @@ public: /// @brief 获取所有动画 const ActionList& GetAllActions() const; -protected: /// \~chinese /// @brief 更新动画 - void UpdateActions(Actor* target, Duration dt); + void Update(Actor* target, Duration dt); private: ActionList actions_; diff --git a/src/kiwano/kiwano.h b/src/kiwano/kiwano.h index e7cb0773..86e32e0f 100644 --- a/src/kiwano/kiwano.h +++ b/src/kiwano/kiwano.h @@ -93,7 +93,7 @@ #include #include #include -#include +#include #include #include #include @@ -119,4 +119,4 @@ #include #include #include -#include +#include diff --git a/src/kiwano/utils/Task.h b/src/kiwano/utils/Task.h index 2fcce5f2..30e4b652 100644 --- a/src/kiwano/utils/Task.h +++ b/src/kiwano/utils/Task.h @@ -24,7 +24,7 @@ namespace kiwano { -class TaskManager; +class TaskScheduler; KGE_DECLARE_SMART_PTR(Task); @@ -39,7 +39,7 @@ class KGE_API Task : public ObjectBase , protected IntrusiveListValue { - friend class TaskManager; + friend class TaskScheduler; friend IntrusiveList; public: diff --git a/src/kiwano/utils/TaskManager.cpp b/src/kiwano/utils/TaskScheduler.cpp similarity index 84% rename from src/kiwano/utils/TaskManager.cpp rename to src/kiwano/utils/TaskScheduler.cpp index 36afa031..c06d88da 100644 --- a/src/kiwano/utils/TaskManager.cpp +++ b/src/kiwano/utils/TaskScheduler.cpp @@ -19,11 +19,11 @@ // THE SOFTWARE. #include -#include +#include namespace kiwano { -void TaskManager::UpdateTasks(Duration dt) +void TaskScheduler::Update(Duration dt) { if (tasks_.IsEmpty()) return; @@ -40,7 +40,7 @@ void TaskManager::UpdateTasks(Duration dt) } } -Task* TaskManager::AddTask(TaskPtr task) +Task* TaskScheduler::AddTask(TaskPtr task) { KGE_ASSERT(task && "AddTask failed, NULL pointer exception"); @@ -53,7 +53,7 @@ Task* TaskManager::AddTask(TaskPtr task) return task.Get(); } -void TaskManager::StopTasks(const String& name) +void TaskScheduler::StopTasks(const String& name) { if (tasks_.IsEmpty()) return; @@ -67,7 +67,7 @@ void TaskManager::StopTasks(const String& name) } } -void TaskManager::StartTasks(const String& name) +void TaskScheduler::StartTasks(const String& name) { if (tasks_.IsEmpty()) return; @@ -81,7 +81,7 @@ void TaskManager::StartTasks(const String& name) } } -void TaskManager::RemoveTasks(const String& name) +void TaskScheduler::RemoveTasks(const String& name) { if (tasks_.IsEmpty()) return; @@ -95,7 +95,7 @@ void TaskManager::RemoveTasks(const String& name) } } -void TaskManager::StopAllTasks() +void TaskScheduler::StopAllTasks() { if (tasks_.IsEmpty()) return; @@ -106,7 +106,7 @@ void TaskManager::StopAllTasks() } } -void TaskManager::StartAllTasks() +void TaskScheduler::StartAllTasks() { if (tasks_.IsEmpty()) return; @@ -117,12 +117,12 @@ void TaskManager::StartAllTasks() } } -void TaskManager::RemoveAllTasks() +void TaskScheduler::RemoveAllTasks() { tasks_.Clear(); } -const TaskList& TaskManager::GetAllTasks() const +const TaskList& TaskScheduler::GetAllTasks() const { return tasks_; } diff --git a/src/kiwano/utils/TaskManager.h b/src/kiwano/utils/TaskScheduler.h similarity index 94% rename from src/kiwano/utils/TaskManager.h rename to src/kiwano/utils/TaskScheduler.h index 1d2c8669..32ae2c33 100644 --- a/src/kiwano/utils/TaskManager.h +++ b/src/kiwano/utils/TaskScheduler.h @@ -25,9 +25,9 @@ namespace kiwano { /** * \~chinese - * @brief 任务管理器 + * @brief 任务调度器 */ -class KGE_API TaskManager +class KGE_API TaskScheduler { public: /// \~chinese @@ -62,12 +62,12 @@ public: /// @brief 获取所有任务 const TaskList& GetAllTasks() const; -protected: /// \~chinese - /// @brief 更新任务 - void UpdateTasks(Duration dt); + /// @brief 更新调度器 + void Update(Duration dt); private: TaskList tasks_; }; + } // namespace kiwano