GCP Assignment 1
UI.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 <SDL.h>
6 #include <SDL_image.h>
7 #include <SDL_ttf.h>
8 #include <iostream>
9 #include <unordered_map>
10 #include "Shader.h"
11 #include "UIObject.h"
12 
16 class UI
17 {
18 public:
25  UI(std::string vertexShaderFileName, std::string fragmentShaderFileName,
26  std::unordered_map<std::string, Shader*> &shaders);
27 
32  UI(std::unordered_map<std::string, Shader*> &shaders);
33 
37  ~UI();
38 
43  virtual void update(float dt) = 0;
44 
48  virtual void draw() = 0;
49 
50 protected:
53 
60  void initialiseShaders(std::string vertexShaderFileName, std::string fragmentShaderFileName,
61  std::unordered_map<std::string, Shader*> &shaders);
62 };
UI(std::string vertexShaderFileName, std::string fragmentShaderFileName, std::unordered_map< std::string, Shader *> &shaders)
Constructs the UI object.
Definition: UI.cpp:5
A class for the 2D user interfaces.
Definition: UI.h:16
void initialiseShaders(std::string vertexShaderFileName, std::string fragmentShaderFileName, std::unordered_map< std::string, Shader *> &shaders)
Initialise the shaders.
Definition: UI.cpp:18
Creates a Shader from an text file, this can then be used with OpenGL.
Definition: Shader.h:12
virtual void update(float dt)=0
A pure virtual function to update the UI.
virtual void draw()=0
A pure virtual function to draw to the screen.
Shader * shader
The shader for the UI.
Definition: UI.h:52
~UI()
Destructs the UI object.
Definition: UI.cpp:39