PROTO::KLUDGE  0.1
Quick prototyping library for games using SDL and OpenGL.
pk::MovingPlaform Class Reference

#include <MovingPlaform.hpp>

Collaboration diagram for pk::MovingPlaform:
Collaboration graph

Public Member Functions

 MovingPlaform (b2World *world, GLTexture &texture, GLRect rect, glm::vec2 endPosition, float platformSpeed)
 Preferred constructor. More...
 
virtual ~MovingPlaform ()
 
pk::GLSpritegetSprite ()
 Get the sprite for the moving platform. More...
 
void setPlatformSpeed (float speed)
 Set the platform speed. More...
 
void update ()
 Update the platform position. Call this function in the update portion of the game loop. More...
 

Private Attributes

b2World * m_world
 a pointer to a Box2D world. More...
 
pk::KinematicBody m_body
 a kinematic body. More...
 
pk::GLSprite m_sprite
 an OpenGL sprite. More...
 
int m_direction
 facing direction of the platform. More...
 
glm::vec2 m_initialPosition
 initial position of the platform. More...
 
glm::vec2 m_endPosition
 ending position of the platform. More...
 
float m_platformSpeed
 speed of the platform movement. More...
 

Constructor & Destructor Documentation

◆ MovingPlaform()

pk::MovingPlaform::MovingPlaform ( b2World *  world,
GLTexture texture,
GLRect  rect,
glm::vec2  endPosition,
float  platformSpeed 
)

Preferred constructor.

◆ ~MovingPlaform()

virtual pk::MovingPlaform::~MovingPlaform ( )
virtual

Member Function Documentation

◆ getSprite()

pk::GLSprite & pk::MovingPlaform::getSprite ( )
inline

Get the sprite for the moving platform.

Returns
GLSprite& - a reference to a GLSprite object.

◆ setPlatformSpeed()

void pk::MovingPlaform::setPlatformSpeed ( float  speed)
inline

Set the platform speed.

Parameters
floatspeed - the speed given as a float.

◆ update()

void pk::MovingPlaform::update ( )

Update the platform position. Call this function in the update portion of the game loop.

Member Data Documentation

◆ m_body

pk::KinematicBody pk::MovingPlaform::m_body
private

a kinematic body.

◆ m_direction

int pk::MovingPlaform::m_direction
private

facing direction of the platform.

◆ m_endPosition

glm::vec2 pk::MovingPlaform::m_endPosition
private

ending position of the platform.

◆ m_initialPosition

glm::vec2 pk::MovingPlaform::m_initialPosition
private

initial position of the platform.

◆ m_platformSpeed

float pk::MovingPlaform::m_platformSpeed
private

speed of the platform movement.

◆ m_sprite

pk::GLSprite pk::MovingPlaform::m_sprite
private

an OpenGL sprite.

◆ m_world

b2World* pk::MovingPlaform::m_world
private

a pointer to a Box2D world.


The documentation for this class was generated from the following file: