Brunot
Loading...
Searching...
No Matches
FlipCardAction.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
24namespace gfx
25{
26class Texture;
27}
28
29class Transform;
30class Sprite;
35class FlipCardAction : public Action
36{
37public:
38
39#pragma region static_functions
40
41#pragma endregion
42
43 /*
44 * @warning Should only be used on entities with a Card component, otherwise it will crash
45 */
47 FlipCardAction(const FlipCardAction&) = default;
48 auto operator=(const FlipCardAction&) -> FlipCardAction& = default;
49 ~FlipCardAction() override = default;
50 FlipCardAction(FlipCardAction&& other) noexcept = default;
51 auto operator=(FlipCardAction&& other) noexcept -> FlipCardAction& = default;
52
53 /*
54 * @warning Should only be used on entities with a Card component, otherwise it will crash
55 */
56 FlipCardAction(float duration);
57 /*
58 * @warning Should only be used on entities with a Card component, otherwise it will crash
59 */
60 FlipCardAction(float duration, const th::Bezier& easingFunction, float initialDelay, float endingDelay);
61
62#pragma region overridden_functions
63
64
65 auto init() -> void override;
66 auto execute() -> void override;
67 auto end() -> void override;
68
69 auto ActionShowMenu() -> void override;
70 auto render() const -> void override;
71
72
73#pragma endregion
74
75#pragma region FlipCardAction_functions
76
77#pragma endregion
78
79private:
80
81#pragma region member_variables
82
83 // We are changing both the texture and scale, so we want both
84 Sprite* sprite = nullptr;
85 Transform* transform = nullptr;
86
87 // The texture we change to after flipping halfway
88 std::string textureName;
89
92
93 bool hasFlipped = false;
94
95#pragma endregion
96
97#pragma region helper_functions
98
99 #pragma endregion
100
101#pragma region static_variables
102
103#pragma endregion
104
105};
A class that changes a variable over a set duration.
float initialDelay
Delay that acts between the action being created and the action initializing.
Definition Action.h:262
float endingDelay
Delay that acts after the action has finished updating but before it has ended.
Definition Action.h:264
Action()=default
FlipCardAction(const FlipCardAction &)=default
std::string textureName
Definition FlipCardAction.h:88
FlipCardAction(FlipCardAction &&other) noexcept=default
~FlipCardAction() override=default
FlipCardAction()
Definition FlipCardAction.cpp:29
auto init() -> void override
Virtual function that is called once, when the Action is first starting up.
Definition FlipCardAction.cpp:46
bool hasFlipped
Definition FlipCardAction.h:93
Sprite * sprite
Definition FlipCardAction.h:84
auto operator=(const FlipCardAction &) -> FlipCardAction &=default
Transform * transform
Definition FlipCardAction.h:85
auto operator=(FlipCardAction &&other) noexcept -> FlipCardAction &=default
auto end() -> void override
Virtual function that is called once, when an Action is finished executing.
Definition FlipCardAction.cpp:76
Vector4D endingScale
Definition FlipCardAction.h:91
auto render() const -> void override
Function used to draw things to screen, useful for things such as debug drawing.
Definition FlipCardAction.cpp:85
auto execute() -> void override
Virtual function that is called every frame to change a game object.
Definition FlipCardAction.cpp:61
auto ActionShowMenu() -> void override
Displays a window in imgui.
Definition FlipCardAction.cpp:80
Vector4D startingScale
Definition FlipCardAction.h:90
A component that renders an image on an entity, or text.
Definition Sprite.h:38
Definition Transform.h:28
holds and manages textures for use with meshes in sprites
Definition Texture.h:33
Definition FlipCardAction.h:25
Definition Vector4D.h:28
Definition Bezier.h:30