Files
eepp/include/eepp/scene/actionmanager.hpp
2026-05-26 19:49:32 -03:00

68 lines
1.4 KiB
C++

#ifndef EE_SCENEACTIONMANAGER_HPP
#define EE_SCENEACTIONMANAGER_HPP
#include <atomic>
#include <eepp/config.hpp>
#include <eepp/scene/action.hpp>
#include <eepp/system/mutex.hpp>
#include <eepp/system/time.hpp>
#include <vector>
using namespace EE::System;
namespace EE { namespace Scene {
class Action;
class Node;
class EE_API ActionManager {
public:
static ActionManager* New();
ActionManager();
~ActionManager();
void addAction( Action* action );
Action* getActionByTag( const Action::UniqueID& tag );
Action* getActionByTagFromTarget( Node* target, const Action::UniqueID& tag,
bool mustBePending = false );
bool removeActionByTag( const Action::UniqueID& tag );
bool removeAction( Action* action );
bool removeActions( const std::vector<EE::Scene::Action*>& actions );
bool removeAllActionsFromTarget( Node* target );
bool removeActionsByTagFromTarget( Node* target, const Action::UniqueID& tag );
std::vector<Action*> getActionsFromTarget( Node* target );
std::vector<Action*> getActionsByTagFromTarget( Node* target, const Action::UniqueID& tag );
void update( const Time& time );
std::size_t count() const;
bool isEmpty() const;
void clear();
protected:
using ActionList = SmallVector<Action*, 32>;
ActionList mActions;
ActionList mActionsRemoveList;
mutable Mutex mMutex;
std::atomic<bool> mUpdating;
void update( const Time& time, Action** actions, size_t count );
};
}} // namespace EE::Scene
#endif