GCP Assignment 1
Public Member Functions | Protected Member Functions | Protected 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)
 Constructs the UIObject. More...
 
 UIObject (float x, float y, float width, float height, SDL_Surface *surface)
 Constructs the UIObject. More...
 
 ~UIObject ()
 Destructs the UIObject. More...
 
void draw (Shader *shader)
 A function to draw to the screen. More...
 

Protected Member Functions

void initialiseObject ()
 Initialise the UIobject. More...
 
void initialiseObject (SDL_Surface *surface)
 Initialise the UIobject. More...
 
void initialiseTexture (SDL_Surface *surfac)
 Initialise the texture. More...
 
Maths::Vec2 convertToOpenGLCoordinate (Maths::Vec2 coordinates)
 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. More...
 

Protected Attributes

GLuint obj
 The VBO for the rectangle. More...
 
Maths::Vec2 dimensions
 The dimensions for the rectangle. More...
 
Maths::Vec2 position
 The position for the UIObject. More...
 
GLuint textureID
 The Texture. More...
 
bool textureBool
 A boolean for if the Model contains a texture. More...
 

Detailed Description

A class for the UI Objects.

Constructor & Destructor Documentation

◆ UIObject() [1/2]

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() [2/2]

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::~UIObject ( )

Destructs the UIObject.

Member Function Documentation

◆ convertToOpenGLCoordinate()

Maths::Vec2 UIObject::convertToOpenGLCoordinate ( Maths::Vec2  coordinates)
protected

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:

◆ draw()

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:

◆ initialiseObject() [1/2]

void UIObject::initialiseObject ( )
protected

Initialise the UIobject.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialiseObject() [2/2]

void UIObject::initialiseObject ( SDL_Surface *  surface)
protected

Initialise the UIobject.

Parameters
surfaceA pointer to the surface for the texture.
Here is the call graph for this function:

◆ initialiseTexture()

void UIObject::initialiseTexture ( SDL_Surface *  surfac)
protected

Initialise the texture.

Parameters
surfaceA pointer to the surface for the texture.
Here is the caller graph for this function:

Member Data Documentation

◆ dimensions

Maths::Vec2 UIObject::dimensions
protected

The dimensions for the rectangle.

◆ obj

GLuint UIObject::obj
protected

The VBO for the rectangle.

◆ position

Maths::Vec2 UIObject::position
protected

The position for the UIObject.

◆ textureBool

bool UIObject::textureBool
protected

A boolean for if the Model contains a texture.

◆ textureID

GLuint UIObject::textureID
protected

The Texture.


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