Emergency 20 Dokumentation  4.2.0
SwingComponent.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
13 #include "em5/Export.h"
14 
17 
18 
19 //[-------------------------------------------------------]
20 //[ Forward declarations ]
21 //[-------------------------------------------------------]
22 namespace qsf
23 {
24  class MovableComponent;
25 }
26 
27 
28 //[-------------------------------------------------------]
29 //[ Namespace ]
30 //[-------------------------------------------------------]
31 namespace em5
32 {
33 
34 
35  //[-------------------------------------------------------]
36  //[ Classes ]
37  //[-------------------------------------------------------]
43  {
44 
45 
46  //[-------------------------------------------------------]
47  //[ Public definitions ]
48  //[-------------------------------------------------------]
49  public:
50  static const uint32 COMPONENT_ID;
51  static const uint32 ANIMATION_TYPE;
52  static const uint32 ANIMATION_CYCLE;
54  static const uint32 VELOCITY_SKEW;
55 
56  static const float MINIMUM_SQUARED_VELOCITY;
57  static const float ACCELERATION_SPEED;
58 
59  // TODO(co) Lookout! Violation of the constant naming convention. Sadly, already edited so we can't change it in here.
61  {
62  PULSE = 0,
65  CARACCELERATION
66  };
67 
68 
69  //[-------------------------------------------------------]
70  //[ Public methods ]
71  //[-------------------------------------------------------]
72  public:
80  explicit SwingComponent(qsf::Prototype* prototype);
81 
86  inline virtual ~SwingComponent();
87 
92  inline AnimationType getAnimationType() const;
93  inline void setAnimationType(AnimationType animationType);
94 
99  inline float getAnimationCycle() const;
100  inline void setAnimationCycle(float animationCycle);
101 
106  inline float getAnimationIntensity() const;
107  inline void setAnimationIntensity(float animationIntensity);
108 
113  inline float getVelocitySkew() const;
114  inline void setVelocitySkew(float velocitySkew);
115 
116 
117  //[-------------------------------------------------------]
118  //[ Protected virtual qsf::Component methods ]
119  //[-------------------------------------------------------]
120  protected:
121  virtual void onSetActive(bool active) override;
122 
123  //[-------------------------------------------------------]
124  //[ Lifecycle ]
125  //[-------------------------------------------------------]
126  virtual bool onStartup() override;
127  virtual void onShutdown() override;
128 
129 
130  //[-------------------------------------------------------]
131  //[ Protected virtual qsf::MovableObjectRenderingListener methods ]
132  //[-------------------------------------------------------]
133  protected:
134  virtual qsf::Component* getMovableObjectRenderingListenerComponent() override;
135  virtual void onObjectRenderingStartup() override;
136 
137 
138  //[-------------------------------------------------------]
139  //[ Protected virtual qsf::JobProxyMovableObjectRenderingListener methods ]
140  //[-------------------------------------------------------]
141  protected:
142  virtual void onUpdateMovableObjectRenderingJob(const qsf::JobArguments& jobArguments) override;
143 
144 
145  //[-------------------------------------------------------]
146  //[ Private methods ]
147  //[-------------------------------------------------------]
148  private:
149  void registerJobProxy();
150  float getVelocity(const qsf::MovableComponent& movableComponent) const;
151 
152 
153  //[-------------------------------------------------------]
154  //[ Private data ]
155  //[-------------------------------------------------------]
156  private:
157  // Connected to the CAMP reflection system
158  AnimationType mAnimationType;
159  float mAnimationCycle;
160  float mAnimationIntensity;
161  float mVelocitySkew;
162 
163  // Internal
164  float mCyclePassed;
165  float mOldSkew;
166  qsf::WeakPtr<qsf::MovableComponent> mMovableComponent;
167 
168 
169  //[-------------------------------------------------------]
170  //[ CAMP reflection system ]
171  //[-------------------------------------------------------]
172  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
173 
174 
175  };
176 
177 
178 //[-------------------------------------------------------]
179 //[ Namespace ]
180 //[-------------------------------------------------------]
181 } // em5
182 
183 
184 //[-------------------------------------------------------]
185 //[ Implementation ]
186 //[-------------------------------------------------------]
188 
189 
190 //[-------------------------------------------------------]
191 //[ CAMP reflection system ]
192 //[-------------------------------------------------------]
194 QSF_CAMP_TYPE_NONCOPYABLE(em5::SwingComponent::AnimationType)
Definition: ActionPriority.h:13
Movable component base class.
Definition: MovableComponent.h:62
static const float MINIMUM_SQUARED_VELOCITY
Minimum squared speed for propeller particle effects.
Definition: SwingComponent.h:56
Abstract component class.
Definition: Component.h:105
AnimationType
Definition: SwingComponent.h:60
Job proxy based OGRE movable object rendering listener.
Definition: JobProxyMovableObjectRenderingListener.h:31
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
static const uint32 VELOCITY_SKEW
"VelocitySkew" unique class property ID inside the class
Definition: SwingComponent.h:54
static const float ACCELERATION_SPEED
Maximum acceleration speed.
Definition: SwingComponent.h:57
static const uint32 ANIMATION_INTENSITY
"AnimationIntensity" unique class property ID inside the class
Definition: SwingComponent.h:53
Definition: SwingComponent.h:63
static const uint32 ANIMATION_CYCLE
"AnimationCycle" unique class property ID inside the class
Definition: SwingComponent.h:52
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
Definition: PickupPersonByParamedicAction.h:21
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
static const uint32 COMPONENT_ID
"em5::SwingComponent" unique component ID
Definition: SwingComponent.h:50
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
Prototype class.
Definition: Prototype.h:100
static const uint32 ANIMATION_TYPE
"AnimationType" unique class property ID inside the class
Definition: SwingComponent.h:51
Definition: SwingComponent.h:64
EMERGENCY 5 swing component class manipulating the "qsf::MovableComponent" instance of the same entit...
Definition: SwingComponent.h:42