Brunot
Loading...
Searching...
No Matches
CallFunctionAction.h
Go to the documentation of this file.
1
12// ____ __ __ __
13// /\__ _\/\ \ /\ \/\ \
14// \/_/\ \/\ \ \___ __ \ \ \_\ \ ___ __ __ ____ __
15// \ \ \ \ \ _ `\ /'__`\ \ \ _ \ / __`\/\ \/\ \ /',__\ /'__`\
16// \ \ \ \ \ \ \ \/\ __/ \ \ \ \ \/\ \L\ \ \ \_\ \/\__, `\/\ __/
17// \ \_\ \ \_\ \_\ \____\ \ \_\ \_\ \____/\ \____/\/\____/\ \____\
18// \/_/ \/_/\/_/\/____/ \/_/\/_/\/___/ \/___/ \/___/ \/____/
19
20
21#pragma once
22#include "Actions/Action.h"
23
28template <typename T>
30{
31public:
32
33#pragma region static_functions
34
35#pragma endregion
36
37 CallFunctionAction() = default;
40 ~CallFunctionAction() override = default;
41 CallFunctionAction(CallFunctionAction&& other) noexcept = default;
42 auto operator=(CallFunctionAction&& other) noexcept -> CallFunctionAction& = default;
43
44 CallFunctionAction(T&& setFuncPointer);
45 CallFunctionAction(T&& setFuncPointer, float initialDelay);
46 CallFunctionAction(T&& setFuncPointer, float duration, const th::Bezier& easingFunction, float initialDelay, float endingDelay);
47
48#pragma region overridden_functions
49
50
51 auto init() -> void override;
52 auto execute() -> void override;
53 auto end() -> void override;
54
55 auto ActionShowMenu() -> void override;
56 auto render() const -> void override;
57
58
59#pragma endregion
60
61#pragma region CallFunctionAction_functions
62
63#pragma endregion
64
65private:
66
67#pragma region member_variables
68
69 std::function<void()> funcPointer;
70
71#pragma endregion
72
73#pragma region helper_functions
74
75 #pragma endregion
76
77#pragma region static_variables
78
79#pragma endregion
80
81};
82
83template <typename T>
85 : Action("CallFunctionAction")
86 , funcPointer(std::forward<T>(setFuncPointer))
87{
88}
89
90// The hard coded values are just default for actions, aside from the initial delay
91template <typename T>
93 : Action("CallFunctionAction", 0.1f, {}, initialDelay, 0.f)
94 , funcPointer(std::forward<T>(setFuncPointer))
95{
96}
97
98template <typename T>
100 float duration, const th::Bezier& easingFunction,
101 float initialDelay, float endingDelay)
102 : Action("CallFunctionAction", duration, easingFunction, initialDelay, endingDelay)
103 , funcPointer(std::forward<T>(setFuncPointer))
104{
105}
106
107template <typename T>
112
113template <typename T>
117
118template <typename T>
122
123template <typename T>
128
129template <typename T>
131{
133}
134
A class that changes a variable over a set duration.
virtual auto ActionShowMenu() -> void
Displays a window in imgui.
Definition Action.cpp:116
float initialDelay
Delay that acts between the action being created and the action initializing.
Definition Action.h:262
virtual auto render() const -> void
Function used to draw things to screen, useful for things such as debug drawing.
Definition Action.cpp:110
float endingDelay
Delay that acts after the action has finished updating but before it has ended.
Definition Action.h:264
Action()=default
CallFunctionAction()=default
auto execute() -> void override
Virtual function that is called every frame to change a game object.
Definition CallFunctionAction.h:114
CallFunctionAction(const CallFunctionAction &)=default
auto init() -> void override
Virtual function that is called once, when the Action is first starting up.
Definition CallFunctionAction.h:108
~CallFunctionAction() override=default
auto operator=(const CallFunctionAction &) -> CallFunctionAction &=default
auto render() const -> void override
Function used to draw things to screen, useful for things such as debug drawing.
Definition CallFunctionAction.h:130
auto operator=(CallFunctionAction &&other) noexcept -> CallFunctionAction &=default
std::function< void()> funcPointer
Definition CallFunctionAction.h:69
CallFunctionAction(CallFunctionAction &&other) noexcept=default
auto ActionShowMenu() -> void override
Displays a window in imgui.
Definition CallFunctionAction.h:124
auto end() -> void override
Virtual function that is called once, when an Action is finished executing.
Definition CallFunctionAction.h:119
Definition Bezier.h:30