V-ART
baseaction.h
Go to the documentation of this file.
1 
5 #ifndef VART_BASEACTION_H
6 #define VART_BASEACTION_H
7 
8 #include "vart/time.h"
9 #include <list>
10 #include <string>
11 
12 namespace VART {
13  class CallBack;
21  class BaseAction {
22  public:
23  // PUBLIC STATIC METHODS
26  static unsigned int MoveAllActive();
27  // PUBLIC METHODS
32  BaseAction();
33 
34  virtual ~BaseAction() { }
35 
36  void SetSpeed(float newSpeed) { speedModifier = newSpeed; }
37  void SetDuration(float seconds) { duration = seconds; }
38  void SetCyclic(bool value) { cyclic = value; }
39  bool IsCyclic() { return cyclic; }
40  bool IsActive() const { return active; }
41 
43  void Deactivate(float seconds);
44 
46  virtual void Deactivate();
47 
52  virtual void Activate();
53  // PUBLIC ATTRIBUTES
54  std::string description;
55 
58 
59  protected:
69  {
70  public:
71  virtual void Initialize() = 0;
72  virtual ~Initializer() {}
73  }; // BaseAction::Initializer
74  // PROTECTED STATIC METHODS
75  // PROTECTED METHODS
79  virtual void Move() = 0;
80 
87  virtual void ComputePositionIndex(bool* cycled);
88  // PROTECTED STATIC ATTRIBUTES
90  static std::list<BaseAction*> activeInstances;
91 
93  static std::list<Initializer*> initializers;
94  // PROTECTED ATTRIBUTES
96  bool cyclic;
97 
99  bool active;
100 
107 
112  float duration;
113 
115  float timeToLive;
116 
122 
128 
131  private:
132  }; // end class declaration
133 } // end namespace
134 
135 #endif
void SetCyclic(bool value)
Definition: baseaction.h:38
float timeToLive
Time (in seconds) to auto deactivate.
Definition: baseaction.h:115
virtual void Deactivate()
Deactivate now.
Definition: baseaction.cpp:23
Header file for V-ART class "Time".
float lastPositionIndex
Position index of last update.
Definition: baseaction.h:127
Animations. Transformations acting through time. Abstract class.
Definition: baseaction.h:21
float speedModifier
Speed modifier.
Definition: baseaction.h:106
static std::list< Initializer * > initializers
List of action initializers.
Definition: baseaction.h:93
float positionIndex
Current position index.
Definition: baseaction.h:121
Action Initializer.
Definition: baseaction.h:68
virtual void Move()=0
Make the action update its targets.
CallBack * callbackPtr
Termination callback.
Definition: baseaction.h:57
BaseAction()
Creates an action with sane defaults.
Definition: baseaction.cpp:17
float duration
Duration in seconds.
Definition: baseaction.h:112
Time lastUpdateTime
Time of last update.
Definition: baseaction.h:130
void SetDuration(float seconds)
Definition: baseaction.h:37
virtual ~BaseAction()
Definition: baseaction.h:34
bool active
Whether the action is currently active (changing its target).
Definition: baseaction.h:99
static unsigned int MoveAllActive()
Moves all active actions.
Definition: baseaction.cpp:74
static std::list< BaseAction * > activeInstances
List of active actions.
Definition: baseaction.h:90
An object that is activated in a callback-like scheme.
Definition: callback.h:18
bool cyclic
Whether the action restarts upon termination.
Definition: baseaction.h:96
void SetSpeed(float newSpeed)
Definition: baseaction.h:36
bool IsActive() const
Definition: baseaction.h:40
std::string description
Definition: baseaction.h:54
virtual void Activate()
Activates the action.
Definition: baseaction.cpp:59
virtual void ComputePositionIndex(bool *cycled)
Computes current position index.
Definition: baseaction.cpp:100
Elapsed time representation.
Definition: time.h:15