50 auto
onUpdate(
float dt) ->
void override;
53 auto
load(const
Stream& stream) ->
void override;
54 auto
save(
Stream& stream) const ->
void override;
74 auto
removeAction(const std::
string& targetAction) ->
void;
84 template <typename ActionType>
85 auto
pushBack(const ActionType& newAction) ->
void
87 allActions.emplace_back(std::make_unique<ActionType>(newAction));
91 template <
typename ActionType>
98 template <
typename ActionType>
99 auto getAction(
const std::string& actionName) -> ActionType*
101 auto isPresent = std::ranges::find_if(
allActions, [&actionName](
const auto& action)
103 return action->getName() == actionName;
108 return dynamic_cast<ActionType*
>(isPresent->get());
121 return item->shouldRemove();
A class that changes a variable over a set duration.
sys::Json Stream
Definition AudioObject.h:20
The base class for components, holding all of their shared All components should inherit from this.
nlohmann::json json
Definition Json.cpp:19
Component that stores all actions currently affecting the parent entity.
Definition ActionList.h:30
auto front() const -> Action *
Definition ActionList.cpp:195
auto getAction(const std::string &actionName) -> ActionType *
Definition ActionList.h:99
friend auto to_json(json &j, const ActionList &a) -> void
Definition ActionList.cpp:155
auto removeAction(const std::string &targetAction) -> void
Removes the first action of a specific type.
Definition ActionList.cpp:182
auto parentTo(GameObject *newParent) -> bool override
Sets the GameObject as a child of another GameObject.
Definition ActionList.cpp:62
auto load(const Stream &stream) -> void override
Implementations will load the state of a GameObject from a th::Json Object.
Definition ActionList.cpp:145
auto onRender() -> void override
called every frame after update has been called for every object.
Definition ActionList.cpp:141
std::vector< std::unique_ptr< Action > > allActions
Definition ActionList.h:116
auto componentShowMenu() -> void override
Definition ActionList.cpp:79
auto pushBack(const std::unique_ptr< Action > &newAction) -> void
Definition ActionList.cpp:205
auto getAction(const std::string &targetAction) -> Action *
Returns the first action of a specific type.
Definition ActionList.cpp:167
ActionList()
Definition ActionList.cpp:26
static auto bindLuaTypes(sol::state &lua) -> void
Definition ActionList.h:36
auto onUpdate(float dt) -> void override
called once every frame.
Definition ActionList.cpp:121
auto operator=(const ActionList &) -> ActionList &
Definition ActionList.cpp:41
auto clear() -> void
Definition ActionList.cpp:217
auto save(Stream &stream) const -> void override
Implementations will load the state of a GameObject to a th::Json object.
Definition ActionList.cpp:150
auto endWindow() -> void override
currently unused, but intended to but was assumed to be necessary for a proper ImGui editor
Definition ActionList.cpp:137
auto operator=(ActionList &&other) noexcept -> ActionList &=default
static auto getEnum() -> ComponentTypeEnum
Definition ActionList.h:32
auto clone() const -> std::unique_ptr< GameObject > override
makes a copy a GameObject even if it's held polymorphically
Definition ActionList.cpp:74
auto back() const -> Action *
Definition ActionList.cpp:200
ActionList(ActionList &&other) noexcept=default
friend auto from_json(const json &j, ActionList &a) -> void
Definition ActionList.cpp:162
auto operator[](int index) const -> Action &
Definition ActionList.cpp:52
auto pushFront(const ActionType &newAction) -> void
Definition ActionList.h:92
static auto HasActionExpired
Definition ActionList.h:119
~ActionList() override=default
auto pushFront(const std::unique_ptr< Action > &newAction) -> void
Definition ActionList.cpp:211
ComponentTypeEnum
This enum lists out every type of component we have.
Definition Component.h:39
Component(ComponentTypeEnum type, const char *typeName)
Definition Component.cpp:72
auto getEntityParent() const -> Entity *
gets the parent as an Entity.
Definition Component.cpp:106
GameObject(std::string typeName, gobj::Type parentType, gobj::Type type)
constructor for gameobject.
Definition GameObject.cpp:24