Jamie Slowgrove - PGG Assignment 2
 All Classes Namespaces Files Functions Variables Typedefs Macros
Public Member Functions | Private Member Functions | Private Attributes | List of all members
UIObject Class Reference

A class for the UI Objects. More...

#include <UIObject.h>

Collaboration diagram for UIObject:
Collaboration graph

Public Member Functions

 UIObject (float x, float y, float width, float height)
 
 UIObject (float x, float y, float width, float height, SDL_Surface *surface)
 
 ~UIObject ()
 
void draw (Shader *shader)
 

Private Member Functions

void initialiseObject ()
 
void initialiseObject (SDL_Surface *surface)
 
void initialiseTexture (SDL_Surface *surfac)
 
glm::vec2 convertToOpenGLCoordinate (glm::vec2 coordinates)
 

Private Attributes

GLuint obj
 
glm::vec2 dimensions
 
glm::vec2 position
 
GLuint textureID
 
bool textureBool
 

Detailed Description

A class for the UI Objects.

Author
Jamie Slowgrove

Constructor & Destructor Documentation

UIObject::UIObject ( float  x,
float  y,
float  width,
float  height 
)

Constructs the UIObject.

Parameters
xThe x position (Top left of the object).
yThe y position (Top left of the object).
widthThe width (Between 0 and 200).
heightThe height (Between 0 and 200).

Here is the call graph for this function:

UIObject::UIObject ( float  x,
float  y,
float  width,
float  height,
SDL_Surface *  surface 
)

Constructs the UIObject.

Parameters
xThe x position (Top left of the object).
yThe y position (Top left of the object).
widthThe width (Between 0 and 200).
heightThe height (Between 0 and 200).
surfaceA pointer to the surface for the texture.

Here is the call graph for this function:

UIObject::~UIObject ( )

Destructs the UIObject.

Here is the call graph for this function:

Member Function Documentation

glm::vec2 UIObject::convertToOpenGLCoordinate ( glm::vec2  coordinates)
private

Converts the coordinates to work with OpenGL. It takes the coordinates and converts them to a number between 0 and 2. It then takes this and -1 from each, setting it to the bottom left position. It then flips the coordinate along the y axis to get the top left position.

Parameters
coordinatesThe coordinates to convert.
Returns
The converted coordinates.

Here is the caller graph for this function:

void UIObject::draw ( Shader shader)

A function to draw to the screen.

Parameters
shaderA pointer to the Shader to use.

Here is the call graph for this function:

Here is the caller graph for this function:

void UIObject::initialiseObject ( )
private

Initialise the UIobject.

Here is the call graph for this function:

Here is the caller graph for this function:

void UIObject::initialiseObject ( SDL_Surface *  surface)
private

Initialise the UIobject.

Parameters
surfaceA pointer to the surface for the texture.

Here is the call graph for this function:

void UIObject::initialiseTexture ( SDL_Surface *  surfac)
private

Initialise the texture.

Parameters
surfaceA pointer to the surface for the texture.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

glm::vec2 UIObject::dimensions
private

The dimensions for the rectangle

GLuint UIObject::obj
private

The VBO for the rectangle

glm::vec2 UIObject::position
private

The position for the UIObject

bool UIObject::textureBool
private

A boolean for if the Model contains a texture

GLuint UIObject::textureID
private

The Texture


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