TurtleBrains  0.3.5
High quality, portable, C++ framework for rapid 2D game development.
tbx_effects_behaviors.hpp
1 
9 #ifndef TurtleBrains_EffectsBehaviors_hpp
10 #define TurtleBrains_EffectsBehaviors_hpp
11 
12 #include <turtle_brains/game/tb_entity_behavior_interface.hpp>
13 #include <turtle_brains/game/tb_game_timer.hpp>
14 #include <turtle_brains/graphics/tb_animated_sprite.hpp>
15 #include <turtle_brains/graphics/tb_camera.hpp>
16 
17 namespace TurtleBrainsExpress
18 {
19  namespace Behaviors
20  {
21 
32  {
33  public:
48  explicit PlayAnimationBehavior(tbGame::Entity& entity, tbGraphics::AnimatedSprite& animatedSprite,
49  const tbCore::tbString& sequenceName, bool isLooping = false, bool isForward = true);
50 
54  virtual ~PlayAnimationBehavior(void);
55 
65  virtual void OnResume(void) override;
66 
73  virtual void OnSimulate(void) override;
74 
75  private:
76  const tbCore::tbString mSequenceName;
77  tbGraphics::AnimatedSprite& mAnimatedSprite;
78  const bool mIsLooping;
79  const bool mIsForward;
80  };
81 
82 //-------------------------------------------------------------------------------------------------------------------//
83 
92  {
93  public:
97  explicit PlaySoundBehavior(tbGame::Entity& entity, const tbCore::tbString& eventTableName, const tbCore::tbString& eventName);
98 
102  virtual ~PlaySoundBehavior(void);
103 
107  virtual void OnResume(void) override;
108 
112  virtual void OnSimulate(void) override;
113 
114  private:
115  const tbCore::tbString mEventTableName;
116  const tbCore::tbString mEventName;
117  };
118 
127  {
128  public:
132  explicit ShakeScreenBehavior(tbGame::Entity& entity, const tbGraphics::Camera::IntensityLevel& shakeIntensity, float shakeDuration = -1.0f);
133 
137  virtual ~ShakeScreenBehavior(void);
138 
142  virtual void OnResume(void) override;
143 
147  virtual void OnSimulate(void) override;
148 
149  private:
150  const tbGraphics::Camera::IntensityLevel mShakeIntensity;
151  const float mShakeDuration; //negative will default to a duration for the intensity.
152  };
153 
158  {
159  public:
163  explicit FadeColorBehavior(tbGame::Entity& entity, tbGraphics::Graphic& graphic, const tbGraphics::Color& desiredColor, const tbGame::GameTimer& time);
164 
168  virtual ~FadeColorBehavior(void);
169 
173  virtual void OnResume(void) override;
174 
178  virtual void OnSimulate(void) override;
179 
180  private:
181  const tbGraphics::Color mDesiredColor;
182  tbGraphics::Color mOriginalColor;
183  const tbGame::GameTimer mMaximumTime;
184  tbGame::GameTimer mTimer;
185  tbGraphics::Graphic& mGraphic;
186  };
187 
188 
189  }; /* namespace Behaviors */
190 }; /* namespace TurtleBrainsExpress */
191 
193 
194 #endif /* TurtleBrains_EffectsBehaviors_hpp */
Definition: tb_graphic.hpp:61
Definition: tb_entity.hpp:46
Definition: tbx_effects_behaviors.hpp:157
IntensityLevel
Definition: tb_camera.hpp:55
Definition: tb_entity_behavior_interface.hpp:24
A collection of objects and functions to express games quickly.
Definition: tb_color.hpp:24
Definition: tbx_effects_behaviors.hpp:126
FadeColorBehavior(tbGame::Entity &entity, tbGraphics::Graphic &graphic, const tbGraphics::Color &desiredColor, const tbGame::GameTimer &time)
Contains high-level objects to control the entities in game worlds.
ShakeScreenBehavior(tbGame::Entity &entity, const tbGraphics::Camera::IntensityLevel &shakeIntensity, float shakeDuration=-1.0f)
Definition: tbx_effects_behaviors.hpp:31
PlayAnimationBehavior(tbGame::Entity &entity, tbGraphics::AnimatedSprite &animatedSprite, const tbCore::tbString &sequenceName, bool isLooping=false, bool isForward=true)
Definition: tbx_effects_behaviors.hpp:91
std::string tbString
Definition: tb_string.hpp:335
Definition: tb_animated_sprite.hpp:119
Definition: tb_game_timer.hpp:25
PlaySoundBehavior(tbGame::Entity &entity, const tbCore::tbString &eventTableName, const tbCore::tbString &eventName)