TaskManager => TaskScheduler, ActionManager => ActionScheduler
This commit is contained in:
parent
e68bb9d94d
commit
6a8b2f528a
|
|
@ -5,7 +5,7 @@
|
|||
<ClInclude Include="..\..\src\kiwano\2d\action\ActionDelay.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\action\ActionGroup.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\action\ActionHelper.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\action\ActionManager.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\action\ActionScheduler.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\action\ActionWalk.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\action\ActionTween.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\action\Animation.h" />
|
||||
|
|
@ -99,7 +99,7 @@
|
|||
<ClInclude Include="..\..\src\kiwano\utils\LocalStorage.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\utils\ResourceCache.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\utils\Task.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\utils\TaskManager.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\utils\TaskScheduler.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\utils\Ticker.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\utils\Timer.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\utils\UserData.h" />
|
||||
|
|
@ -109,7 +109,7 @@
|
|||
<ClCompile Include="..\..\src\kiwano\2d\action\Action.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\action\ActionDelay.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\action\ActionGroup.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\action\ActionManager.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\action\ActionScheduler.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\action\ActionWalk.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\action\ActionTween.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\action\Animation.cpp" />
|
||||
|
|
@ -175,7 +175,7 @@
|
|||
<ClCompile Include="..\..\src\kiwano\utils\LocalStorage.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\utils\ResourceCache.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\utils\Task.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\utils\TaskManager.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\utils\TaskScheduler.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\utils\Ticker.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\utils\Timer.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\utils\UserData.cpp" />
|
||||
|
|
|
|||
|
|
@ -90,9 +90,6 @@
|
|||
<ClInclude Include="..\..\src\kiwano\2d\action\ActionTween.h">
|
||||
<Filter>2d\action</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\2d\action\ActionManager.h">
|
||||
<Filter>2d\action</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\2d\action\Animation.h">
|
||||
<Filter>2d\action</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -324,9 +321,6 @@
|
|||
<ClInclude Include="..\..\src\kiwano\utils\Task.h">
|
||||
<Filter>utils</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\utils\TaskManager.h">
|
||||
<Filter>utils</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\utils\Ticker.h">
|
||||
<Filter>utils</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -336,6 +330,12 @@
|
|||
<ClInclude Include="..\..\src\kiwano\utils\Xml.h">
|
||||
<Filter>utils</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\utils\TaskScheduler.h">
|
||||
<Filter>utils</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\2d\action\ActionScheduler.h">
|
||||
<Filter>2d\action</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\kiwano\2d\Canvas.cpp">
|
||||
|
|
@ -377,9 +377,6 @@
|
|||
<ClCompile Include="..\..\src\kiwano\2d\action\ActionTween.cpp">
|
||||
<Filter>2d\action</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\2d\action\ActionManager.cpp">
|
||||
<Filter>2d\action</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\2d\action\Animation.cpp">
|
||||
<Filter>2d\action</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -548,15 +545,18 @@
|
|||
<ClCompile Include="..\..\src\kiwano\utils\Task.cpp">
|
||||
<Filter>utils</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\utils\TaskManager.cpp">
|
||||
<Filter>utils</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\utils\Ticker.cpp">
|
||||
<Filter>utils</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\utils\Timer.cpp">
|
||||
<Filter>utils</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\utils\TaskScheduler.cpp">
|
||||
<Filter>utils</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\2d\action\ActionScheduler.cpp">
|
||||
<Filter>2d\action</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="suppress_warning.ruleset" />
|
||||
|
|
|
|||
|
|
@ -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_)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@
|
|||
#include <kiwano/core/ObjectBase.h>
|
||||
#include <kiwano/core/Time.h>
|
||||
#include <kiwano/core/EventDispatcher.h>
|
||||
#include <kiwano/utils/TaskManager.h>
|
||||
#include <kiwano/2d/action/ActionManager.h>
|
||||
#include <kiwano/utils/TaskScheduler.h>
|
||||
#include <kiwano/2d/action/ActionScheduler.h>
|
||||
#include <kiwano/2d/Component.h>
|
||||
|
||||
namespace kiwano
|
||||
|
|
@ -62,8 +62,8 @@ typedef IntrusiveList<ActorPtr> ActorList;
|
|||
*/
|
||||
class KGE_API Actor
|
||||
: public ObjectBase
|
||||
, public TaskManager
|
||||
, public ActionManager
|
||||
, public TaskScheduler
|
||||
, public ActionScheduler
|
||||
, public EventDispatcher
|
||||
, protected IntrusiveListValue<ActorPtr>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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<Action>
|
||||
, protected IntrusiveListValue<ActionPtr>
|
||||
{
|
||||
friend class ActionManager;
|
||||
friend class ActionScheduler;
|
||||
friend class ActionGroup;
|
||||
friend IntrusiveList<ActionPtr>;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,12 +19,13 @@
|
|||
// THE SOFTWARE.
|
||||
|
||||
#include <kiwano/2d/Actor.h>
|
||||
#include <kiwano/2d/action/ActionManager.h>
|
||||
#include <kiwano/2d/action/ActionScheduler.h>
|
||||
#include <kiwano/core/Logger.h>
|
||||
|
||||
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_;
|
||||
}
|
||||
|
|
@ -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_;
|
||||
|
|
@ -93,7 +93,7 @@
|
|||
#include <kiwano/2d/action/ActionDelay.h>
|
||||
#include <kiwano/2d/action/ActionGroup.h>
|
||||
#include <kiwano/2d/action/ActionHelper.h>
|
||||
#include <kiwano/2d/action/ActionManager.h>
|
||||
#include <kiwano/2d/action/ActionScheduler.h>
|
||||
#include <kiwano/2d/action/ActionTween.h>
|
||||
#include <kiwano/2d/action/ActionWalk.h>
|
||||
#include <kiwano/2d/action/Animation.h>
|
||||
|
|
@ -119,4 +119,4 @@
|
|||
#include <kiwano/utils/Ticker.h>
|
||||
#include <kiwano/utils/EventTicker.h>
|
||||
#include <kiwano/utils/Task.h>
|
||||
#include <kiwano/utils/TaskManager.h>
|
||||
#include <kiwano/utils/TaskScheduler.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<TaskPtr>
|
||||
{
|
||||
friend class TaskManager;
|
||||
friend class TaskScheduler;
|
||||
friend IntrusiveList<TaskPtr>;
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@
|
|||
// THE SOFTWARE.
|
||||
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/utils/TaskManager.h>
|
||||
#include <kiwano/utils/TaskScheduler.h>
|
||||
|
||||
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_;
|
||||
}
|
||||
|
|
@ -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
|
||||
Loading…
Reference in New Issue