Slippers Engine
 
Loading...
Searching...
No Matches
Game Class Reference

Responsible for Game Start, Game End, Load Resources, and window related functions. More...

#include <Game.h>

Collaboration diagram for Game:
Collaboration graph

Static Public Member Functions

static int GetHeight ()
 Returns window's height in pixels.
 
static int GetWidth ()
 Returns window's width in pixels.
 
static void SetClear (float r, float g, float b, float a)
 Sets window's background color to an RGBA value.
 
static void SetClear (Vect color)
 Sets window's background color using a vector.
 
static void SetWidthHeight (int w, int h)
 Directly sets width and height of the window in pixels.
 
static void SetWidthHeightDefault ()
 Sets width and height of the window to be a quarter of the monitor size.
 
static void SetWindowName (const char *name)
 Sets window's name.
 

Private Member Functions

void GameStart ()
 Fill GameStart.cpp with actions that should occur when the game is launched.
 
void GameEnd ()
 Fill GameEnd.cpp with actions that should occur when the game is closed.
 
void LoadResources ()
 Fill LoadResources.cpp with assets you want to load.
 

Detailed Description

Responsible for Game Start, Game End, Load Resources, and window related functions.

Member Function Documentation

◆ GameEnd()

void Game::GameEnd ( )
private

Fill GameEnd.cpp with actions that should occur when the game is closed.

Example:

void Game::GameEnd() {
//Delete static objects
}
void GameEnd()
Fill GameEnd.cpp with actions that should occur when the game is closed.

◆ GameStart()

void Game::GameStart ( )
private

Fill GameStart.cpp with actions that should occur when the game is launched.

Example:

Game::SetWindowName("Demo Game");
Game::SetClear(0.4f, 0.4f, 0.8f, 1.0f);
//Game::SetClear(Color::LightSkyBlue);
Game::SetWidthHeightDefault(); // 1/4 of the screen
//Game::SetWidthHeight(800, 600); // set dimension directly
}
static void SetWidthHeightDefault()
Sets width and height of the window to be a quarter of the monitor size.
Definition Game.h:192
static void SetWindowName(const char *name)
Sets window's name.
Definition Game.h:198
void GameStart()
Fill GameStart.cpp with actions that should occur when the game is launched.
static void SetClear(float r, float g, float b, float a)
Sets window's background color to an RGBA value.
Definition Game.h:176

◆ GetHeight()

static int Game::GetHeight ( )
static

Returns window's height in pixels.

Returns
int

◆ GetWidth()

static int Game::GetWidth ( )
static

Returns window's width in pixels.

Returns
int

◆ LoadResources()

void Game::LoadResources ( )
private

Fill LoadResources.cpp with assets you want to load.

Warning
A Start scene must be loaded here, or else an empty scene will be shown instead.

Example:

//Models
ModelManager::LoadModel("Plane", 400, 2, 2);
ModelManager::LoadModel("Demo Model", "demo_model.azul");
ModelManager::LoadModel("Unit Sphere", Model::UnitSphere);
//Textures
TextureManager::LoadTexture("Demo Texture", "demo_texture.tga");
TextureManager::LoadTexture("Grid", "grid.tga");
//Shaders
ShaderManager::LoadShader("ColorNoText", "colorNoTextureRender");
//Images
ImageManager::Load("Demo Image", TextureManager::GetTexture("Demo Texture"));
SceneManager::SetStartScene(new SceneDemo());
}
void LoadResources()
Fill LoadResources.cpp with assets you want to load.
static void Load(const MapKey &key, Texture *tex)
Image Model with KEY and TEXTURE.
Definition ImageManager.h:63
static void LoadModel(const MapKey &key, const std::string &path)
Load Model with KEY and FILE PATH.
Definition ModelManager.h:69
static void SetStartScene(Scene *start)
Sets pointer to start scene.
Definition SceneManager.h:64
static void LoadShader(const MapKey &key, const std::string &path)
Load Shader with KEY and FILE PATH.
Definition ShaderManager.h:63
static Texture * GetTexture(const MapKey &key)
Returns texture pointer with given KEY.
Definition TextureManager.h:134
static void LoadTexture(const MapKey &key, const std::string &path)
Load Texture with KEY and FILE PATH.
Definition TextureManager.h:100

◆ SetClear() [1/2]

static void Game::SetClear ( float r,
float g,
float b,
float a )
static

Sets window's background color to an RGBA value.

Parameters
r
g
b
a

◆ SetClear() [2/2]

static void Game::SetClear ( Vect color)
static

Sets window's background color using a vector.

Parameters
color

◆ SetWidthHeight()

static void Game::SetWidthHeight ( int w,
int h )
static

Directly sets width and height of the window in pixels.

Parameters
w
h

◆ SetWidthHeightDefault()

static void Game::SetWidthHeightDefault ( )
static

Sets width and height of the window to be a quarter of the monitor size.

◆ SetWindowName()

static void Game::SetWindowName ( const char * name)
static

Sets window's name.

Parameters
name