TDME2 1.9.121
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GUIEffect.cpp
Go to the documentation of this file.
2
3#include <tdme/tdme.h>
8
14
15GUIEffect::GUIEffect(EffectType type, GUINode* guiNode): type(type), node(guiNode)
16{
17}
18
20 if (action != nullptr) delete action;
21}
22
24{
28 timePassed = 0.0f;
29 timeLast = -1LL;
31 yoyoLeft = yoyo == true?1:0;
32 active = true;
33}
34
36{
37 active = false;
38}
39
41{
42 if (active == false) return false;
43 // TODO: Maybe do not use timing from main engine
44 timePassed = timeLast == -1LL?0.0f:static_cast<float>(Engine::getInstance()->getTiming()->getCurrentFrameAtTime() - timeLast) / 1000.0f;
46 timeLast = Engine::getInstance()->getTiming()->getCurrentFrameAtTime();
47 if (timeLeft < 0.0f) {
48 timeLeft = 0.0f;
49 if (yoyoLeft > 0) {
51 timePassed = 0.0f;
52 yoyoLeft--;
55 } else
56 if (repeat == -1 || repeatLeft > 0) {
58 timePassed = 0.0f;
59 if (repeat != -1) repeatLeft--;
60 yoyoLeft = yoyo == true?1:0;
63 } else
64 if (persistant == false) {
65 active = false;
66 return true;
67 }
68 }
69 return false;
70}
71
Engine main class.
Definition: Engine.h:122
Timing class.
Definition: Timing.h:17
GUI effect base class.
Definition: GUIEffect.h:23
GUIEffectState originalEndState
Definition: GUIEffect.h:43
virtual void start()
Start this effect.
Definition: GUIEffect.cpp:23
virtual void stop()
Stop this effect.
Definition: GUIEffect.cpp:35
GUIEffectState originalStartState
Definition: GUIEffect.h:42
virtual bool update(GUIRenderer *guiRenderer)
Updates the effect to GUI renderer and updates time.
Definition: GUIEffect.cpp:40
virtual ~GUIEffect()
Destructor.
Definition: GUIEffect.cpp:19
GUIEffectState startState
Definition: GUIEffect.h:44
GUI node base class.
Definition: GUINode.h:63
GUIEffectState * getEffectState()
Definition: GUINode.h:647
Action Interface.
Definition: Action.h:12