PROTO::KLUDGE  0.1
Quick prototyping library for games using SDL and OpenGL.
GLSprite.hpp
Go to the documentation of this file.
1 #ifndef GLSPRITE_HPP
2 #define GLSPRITE_HPP
3 
6 
7 namespace pk
8 {
9 
10 //forward declaration
11 class GLTexture;
12 
13 class GLSprite : public GLDrawable, public GLTransformable
14 {
15  private:
21  void updateNormals(GLfloat * vertices, unsigned int verticeCount, unsigned int stride);
22 
28  void updateGeometry();
29 
30  public:
36  GLSprite();
37 
43  GLSprite(GLTexture& t, GLRect rect);
44 
45  virtual ~GLSprite();
46 
48 
50 
59 
65  void setFillColor(glm::vec4 fillColor);
66 
74  glm::vec4 &getFillColor(){ return m_fillColor; };
75 
81  void setVertexColors(GLfloat colors [16]);
82 
90  GLfloat* getVertexColors(){ return m_vertexColors; };
91 
98  void draw(GLStates& states);
99 
100  private:
103  glm::vec4 m_fillColor;
104  GLfloat m_vertexColors [16];
105 };
106 
107 }
108 
109 #endif // GLSPRITE_HPP
GLTexture * m_texture
A pointer to a GLTexture to use for the GLSprite.
Definition: GLSprite.hpp:101
Definition: Game.hpp:7
virtual ~GLSprite()
Decorator class for creating easing OpenGL transformations for game objects.
Definition: GLTransformable.hpp:51
Definition: GLDrawable.hpp:16
void draw(GLStates &states)
Draw the GLSprite to the screen.
Definition: GLSprite.hpp:90
GLTexture * getTexture()
Definition: GLSprite.hpp:58
void updateNormals(GLfloat *vertices, unsigned int verticeCount, unsigned int stride)
Update the internal lighting normals of the GLSprite.
GLfloat * getVertexColors()
Get the current vertex colors for the GLSprite.
Definition: GLSprite.hpp:90
GLRect m_textureRect
Stores the value of the GLTexture's texture rect.
Definition: GLSprite.hpp:102
GLfloat m_vertexColors[16]
Array of individual vertex colors.
Definition: GLSprite.hpp:104
void setFillColor(glm::vec4 fillColor)
GLSprite()
Default constructor - not the one you're looking for. See below.
Stores the states used to draw OpenGL objects.
Definition: GLStates.hpp:16
GLRect & getTextureRect()
Definition: GLSprite.hpp:49
Useful for defining size and origin of an OpenGL object.
Definition: GLTransformable.hpp:15
void updateGeometry()
Update the internal geometry of the GLSprite.
glm::vec4 m_fillColor
Fill color.
Definition: GLSprite.hpp:103
void setTextureRect(GLRect r)
Definition: GLSprite.hpp:47
Class for creating textures usable with OpenGL from SDL.
Definition: GLTexture.hpp:57
void setVertexColors(GLfloat colors [16])
Set the individual values for the vertex colors of the GLSprite.
Definition: GLSprite.hpp:58
glm::vec4 & getFillColor()
Get the current fill color for the GLSprite.
Definition: GLSprite.hpp:74
Definition: GLSprite.hpp:13