PROTO::KLUDGE  0.1
Quick prototyping library for games using SDL and OpenGL.
MovingPlaform.hpp
Go to the documentation of this file.
1 #ifndef MOVINGPLAFORM_HPP
2 #define MOVINGPLAFORM_HPP
3 
5 #include "graphics/GLSprite.hpp"
6 
7 namespace pk
8 {
9 
18 {
19  public:
24  MovingPlaform(b2World* world, GLTexture& texture, GLRect rect, glm::vec2 endPosition, float platformSpeed);
25  virtual ~MovingPlaform();
26 
35 
42  void setPlatformSpeed(float speed){ m_platformSpeed = speed; };
43 
50  void update();
51 
52  protected:
53 
54  private:
55  b2World* m_world;
59  glm::vec2 m_initialPosition;
60  glm::vec2 m_endPosition;
62 };
63 
64 }
65 
66 #endif // MOVINGPLAFORM_HPP
MovingPlaform(b2World *world, GLTexture &texture, GLRect rect, glm::vec2 endPosition, float platformSpeed)
Preferred constructor.
Definition: MovingPlaform.hpp:17
Definition: Game.hpp:7
pk::GLSprite m_sprite
an OpenGL sprite.
Definition: MovingPlaform.hpp:57
pk::KinematicBody m_body
a kinematic body.
Definition: MovingPlaform.hpp:56
virtual ~MovingPlaform()
void setPlatformSpeed(float speed)
Set the platform speed.
Definition: MovingPlaform.hpp:42
pk::GLSprite & getSprite()
Get the sprite for the moving platform.
Definition: MovingPlaform.hpp:34
float m_platformSpeed
speed of the platform movement.
Definition: MovingPlaform.hpp:61
Useful for defining size and origin of an OpenGL object.
Definition: GLTransformable.hpp:15
A class wrapper to ease the instantiation and use of Box2D kinematic bodies. It also performs convers...
Definition: KinematicBody.hpp:20
b2World * m_world
a pointer to a Box2D world.
Definition: MovingPlaform.hpp:55
void update()
Update the platform position. Call this function in the update portion of the game loop...
Definition: MovingPlaform.hpp:42
glm::vec2 m_initialPosition
initial position of the platform.
Definition: MovingPlaform.hpp:59
glm::vec2 m_endPosition
ending position of the platform.
Definition: MovingPlaform.hpp:60
int m_direction
facing direction of the platform.
Definition: MovingPlaform.hpp:58
Class for creating textures usable with OpenGL from SDL.
Definition: GLTexture.hpp:57
Definition: GLSprite.hpp:13