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

Decorator class for creating easing OpenGL transformations for game objects. More...

#include <GLTransformable.hpp>

Inheritance diagram for pk::GLTransformable:
Inheritance graph
Collaboration diagram for pk::GLTransformable:
Collaboration graph

Public Member Functions

 GLTransformable ()
 Default constructor. More...
 
virtual ~GLTransformable ()
 
void setRect (GLRect r)
 Set the bounding rectangle for the GLTransformable object. Useful for calculating origin and size definitions. More...
 
GLRectgetRect ()
 Get the current bounding rectangle of the GLTransformable object. More...
 
void setWidth (GLfloat w)
 Convenient function for setting the width of the GLTransformable. More...
 
GLfloat & getWidth ()
 Get the width of the GLTransformable. More...
 
void setHeight (GLfloat h)
 
GLfloat & getHeight ()
 Get the height of the GLTransformable. More...
 
void setOrigin (glm::vec2 origin)
 Set the origin of the GLTransformable in screen coordinates (NOT normalized coordinates such as clip coordinates for example). More...
 
glm::vec2 & getOrigin ()
 Get the origin of the GLTransformable in screen coordinates (NOT normalized coordinates such as clip coordinates for example). More...
 
void setPosition (glm::vec2 position)
 Set the position of the GLTransformable in screen coordinates (NOT normalized coordinates such as clip coordinates for example). More...
 
const glm::vec2 & getPosition ()
 Get the position of the GLTransformable in screen coordinates (NOT normalized coordinates such as clip coordinates for example). More...
 
void move (glm::vec2 offset)
 Move the GLTransformable by a constant offset value in screen coordinates (NOT normalized coordinates such as clip coordinates for example). More...
 
void setAngle (float angle)
 Set the angle of the GLTransformable (in degrees, NOT radians). More...
 
float getAngle ()
 Get the angle of the GLTransformable (in degrees, NOT radians). More...
 
void rotate (float degrees)
 Rotate the GLTransformable by a constant value (in degrees, NOT radians). (in degrees, NOT radians). More...
 
void setScale (glm::vec2 scale)
 Set the scale of the GLTransformable. More...
 
glm::vec2 getScale ()
 Get the scale of the GLTransformable. More...
 
void scale (glm::vec2 scale)
 Scale the GLTransformable by a constant factor specified as a glm::vec2 of floats. More...
 
void clear ()
 Clear the buffers and reset the GLTransformable to an uninitialized state. More...
 

Public Attributes

GLTransformData m_data
 Internal transform data for GLTransformable inherited classes. More...
 

Detailed Description

Decorator class for creating easing OpenGL transformations for game objects.

Constructor & Destructor Documentation

◆ GLTransformable()

pk::GLTransformable::GLTransformable ( )

Default constructor.

◆ ~GLTransformable()

virtual pk::GLTransformable::~GLTransformable ( )
virtual

Member Function Documentation

◆ clear()

void pk::GLTransformable::clear ( )

Clear the buffers and reset the GLTransformable to an uninitialized state.

◆ getAngle()

float pk::GLTransformable::getAngle ( )
inline

Get the angle of the GLTransformable (in degrees, NOT radians).

Returns
float - a plain old float.

◆ getHeight()

GLfloat & pk::GLTransformable::getHeight ( )
inline

Get the height of the GLTransformable.

Returns
GLfloat & - reference to the height of the GLTransformable.

◆ getOrigin()

glm::vec2 & pk::GLTransformable::getOrigin ( )
inline

Get the origin of the GLTransformable in screen coordinates (NOT normalized coordinates such as clip coordinates for example).

Returns
glm::vec2 - a glm::vec2 vector of floats corresponding to the origin of the GLTransformable.

◆ getPosition()

const glm::vec2 & pk::GLTransformable::getPosition ( )
inline

Get the position of the GLTransformable in screen coordinates (NOT normalized coordinates such as clip coordinates for example).

Returns
glm::vec2 - a glm::vec2 vector of floats corresponding to the position of the GLTransformable.

◆ getRect()

GLRect & pk::GLTransformable::getRect ( )
inline

Get the current bounding rectangle of the GLTransformable object.

Returns
GLRect & - a reference to a bounding rectangle.

◆ getScale()

glm::vec2 pk::GLTransformable::getScale ( )
inline

Get the scale of the GLTransformable.

Returns
glm::vec2 - a glm::vec2 of floats.

◆ getWidth()

GLfloat & pk::GLTransformable::getWidth ( )
inline

Get the width of the GLTransformable.

Returns
GLfloat & - reference to the width of the GLTransformable.

◆ move()

void pk::GLTransformable::move ( glm::vec2  offset)
inline

Move the GLTransformable by a constant offset value in screen coordinates (NOT normalized coordinates such as clip coordinates for example).

Parameters
glm::vec2offset - the offset you wish to move the GLTransformable by.
Here is the call graph for this function:

◆ rotate()

void pk::GLTransformable::rotate ( float  degrees)
inline

Rotate the GLTransformable by a constant value (in degrees, NOT radians). (in degrees, NOT radians).

Parameters
floatdegrees - degrees specifying the value to rotate the GLTransformable by.
Here is the call graph for this function:

◆ scale()

void pk::GLTransformable::scale ( glm::vec2  scale)
inline

Scale the GLTransformable by a constant factor specified as a glm::vec2 of floats.

Parameters
glm::vec2scale - the factor you wish to scale the GLTransformable by.
Here is the call graph for this function:

◆ setAngle()

void pk::GLTransformable::setAngle ( float  angle)
inline

Set the angle of the GLTransformable (in degrees, NOT radians).

Parameters
floatangle - degrees specifying the angle of the GLTransformable.

◆ setHeight()

void pk::GLTransformable::setHeight ( GLfloat  h)
inline

◆ setOrigin()

void pk::GLTransformable::setOrigin ( glm::vec2  origin)
inline

Set the origin of the GLTransformable in screen coordinates (NOT normalized coordinates such as clip coordinates for example).

Parameters
glm::vec2origin - a glm::vec2

◆ setPosition()

void pk::GLTransformable::setPosition ( glm::vec2  position)
inline

Set the position of the GLTransformable in screen coordinates (NOT normalized coordinates such as clip coordinates for example).

Parameters
glm::vec2position - a glm::vec2

◆ setRect()

void pk::GLTransformable::setRect ( GLRect  r)
inline

Set the bounding rectangle for the GLTransformable object. Useful for calculating origin and size definitions.

Parameters
GLRectr - a bounding rectangle for the GLTransformable object.

◆ setScale()

void pk::GLTransformable::setScale ( glm::vec2  scale)
inline

Set the scale of the GLTransformable.

Parameters
glm::vec2scale - the scale you wish to assign to the GLTransformable.
Here is the call graph for this function:

◆ setWidth()

void pk::GLTransformable::setWidth ( GLfloat  w)
inline

Convenient function for setting the width of the GLTransformable.

Parameters
GLfloatw - width of the GLTransformable.

Member Data Documentation

◆ m_data

GLTransformData pk::GLTransformable::m_data

Internal transform data for GLTransformable inherited classes.


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