GCP Assignment 1
UIObject.h
Go to the documentation of this file.
1 //DISCLAMER - This is a modified version of code from one of my other assignments.
2 
3 #pragma once
4 
5 #include <iostream>
6 #include <SDL.h>
7 #include "Shader.h"
8 #include "../Maths/Vec2.h"
9 
13 class UIObject
14 {
15 public:
23  UIObject(float x, float y, float width, float height);
24 
33  UIObject(float x, float y, float width, float height, SDL_Surface* surface);
34 
38  ~UIObject();
39 
44  void draw(Shader * shader);
45 
46 protected:
48  GLuint obj;
54  GLuint textureID;
57 
61  void initialiseObject();
62 
67  void initialiseObject(SDL_Surface* surface);
68 
73  void initialiseTexture(SDL_Surface* surfac);
74 
84 };
UIObject(float x, float y, float width, float height)
Constructs the UIObject.
Definition: UIObject.cpp:5
Maths::Vec2 convertToOpenGLCoordinate(Maths::Vec2 coordinates)
Converts the coordinates to work with OpenGL. It takes the coordinates and converts them to a number ...
Definition: UIObject.cpp:209
Maths::Vec2 position
The position for the UIObject.
Definition: UIObject.h:52
Maths::Vec2 dimensions
The dimensions for the rectangle.
Definition: UIObject.h:50
void draw(Shader *shader)
A function to draw to the screen.
Definition: UIObject.cpp:224
GLuint obj
The VBO for the rectangle.
Definition: UIObject.h:48
A class for the UI Objects.
Definition: UIObject.h:13
Creates a Shader from an text file, this can then be used with OpenGL.
Definition: Shader.h:12
Contains the Vec2 structure with functions and overloaded operators.
Definition: Vec2.h:16
GLuint textureID
The Texture.
Definition: UIObject.h:54
void initialiseTexture(SDL_Surface *surfac)
Initialise the texture.
Definition: UIObject.cpp:150
~UIObject()
Destructs the UIObject.
Definition: UIObject.cpp:35
bool textureBool
A boolean for if the Model contains a texture.
Definition: UIObject.h:56
void initialiseObject()
Initialise the UIobject.
Definition: UIObject.cpp:42