Level H Engine
Application.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <SDL.h>
4 #include <string>
5 #include <memory>
6 #include "../Maths/Vec2.h"
7 #include "../Maths/Vec3.h"
8 #include "../States/StateManager.h"
9 #include "GameObject.h"
10 
12 class GameObject;
13 
18 {
19 public:
28  static void init(std::string title, Vec2 windowPos, Vec2 windowRes, bool fullscreen, float frameRate);
29 
35  static void run(int argc, char *argv[]);
36 
40  static void destroy();
41 
45  static std::vector<std::shared_ptr<GameObject> >& getGameObjects();
46 
50  static std::shared_ptr<GameObject>& getCamera();
51 
56  static void setBackgroundColour(Vec3 colour);
57 
62  static void setDT(float inDT);
63 
68  static float getDT();
69 
74  static void drawLoadingScreen();
75 
77  static std::shared_ptr< GameObject > camera;
78 
79 private:
84  static bool initSDL();
85 
90  static bool initTTF();
91 
96  static bool initMixer();
97 
102  static bool initGLEW();
103 
105  static SDL_Window *window;
107  static SDL_GLContext glcontext;
111  static std::vector< std::shared_ptr<GameObject> > gameObjects;
115  static std::string loadingSpriteID;
117  static float dt;
118 };
static void init(std::string title, Vec2 windowPos, Vec2 windowRes, bool fullscreen, float frameRate)
A static function to initialise Application.
Definition: Application.cpp:21
static Vec3 backgroundColour
The background colour.
Definition: Application.h:113
static void setBackgroundColour(Vec3 colour)
A static function to set the background colour.
Definition: Application.cpp:203
static void destroy()
A static function that destroys the Application.
Definition: Application.cpp:126
static std::string loadingSpriteID
The loading sprite.
Definition: Application.h:115
Contains the Vec2 structure with functions and overloaded operators.
Definition: Vec2.h:8
Creates a StateManager object.
Definition: StateManager.h:9
static std::shared_ptr< GameObject > camera
A shared pointer for the camera.
Definition: Application.h:77
static SDL_Window * window
A pointer for the window.
Definition: Application.h:105
static bool initTTF()
A static function to initialise SDL TTF.
Definition: Application.cpp:170
static std::vector< std::shared_ptr< GameObject > > & getGameObjects()
A static function to get game objects.
Definition: Application.cpp:193
static std::vector< std::shared_ptr< GameObject > > gameObjects
A vector of the game objects.
Definition: Application.h:111
static std::shared_ptr< GameObject > & getCamera()
A static function to get camera.
Definition: Application.cpp:198
Contains details and functions for the game object.
Definition: GameObject.h:15
Contains the Vec3 structure with functions and overloaded operators.
Definition: Vec3.h:8
static bool initSDL()
A static function to initialise SDL.
Definition: Application.cpp:158
static void setDT(float inDT)
A static function to set delta time.
Definition: Application.cpp:208
static float dt
The delta time.
Definition: Application.h:117
static bool initMixer()
A static function to initialise SDL Mixer.
Definition: Application.cpp:182
static void drawLoadingScreen()
A static function to get set the background colour.
Definition: Application.cpp:218
static SDL_GLContext glcontext
The SDL OpenGL context.
Definition: Application.h:107
static float getDT()
A static function to get the delta time.
Definition: Application.cpp:213
static void run(int argc, char *argv[])
A static function that runs Application.
Definition: Application.cpp:76
Contains details and functions for the application.
Definition: Application.h:17
static bool initGLEW()
A static function to initialise GLEW.
Definition: Application.cpp:135
static StateManager * stateManager
A pointer to the state manager.
Definition: Application.h:109