The main game class that initialises and cleans up data as well as runs the game loop.
More...
#include <VGame.h>
|
int | Run (const sf::String &title, VState *initialState, int windowwidth, int windowheight, float fps=60, int flags=sf::Style::Default, const sf::ContextSettings &settings=sf::ContextSettings()) |
|
int | Run (const sf::String &title, VState *initialState, int windowwidth, int windowheight, int screenwidth, int screenheight, float fps=60, int flags=sf::Style::Default, const sf::ContextSettings &settings=sf::ContextSettings()) |
|
The main game class that initialises and cleans up data as well as runs the game loop.
◆ Cleanup()
virtual int VGame::Cleanup |
( |
| ) |
|
|
protectedvirtual |
Cleans up any remaining game data, including all global properties. Occurs when the game will shut down.
- Returns
- An integer returning the result of the cleanup. If 0, there were no errors, else will output the result.
◆ HandleEvents()
virtual void VGame::HandleEvents |
( |
| ) |
|
|
protectedvirtual |
Handle any polled events in the form of sf::Event objects during the game loop. Some events such as sf::Event::Close and sf::Event::Resize are handled in VGame.
◆ Init()
virtual int VGame::Init |
( |
| ) |
|
|
protectedvirtual |
Initialises the game, such as setting up the window and initial state for example.
- Returns
- An integer returning the result of the intialisation. If 0, there were no errors, else will result in the game automatically closing and output the result.
◆ PostRender()
virtual void VGame::PostRender |
( |
| ) |
|
|
protectedvirtual |
Applies the rendered scene to the window, after applying any post effects currently enabled.
◆ PreRender()
virtual void VGame::PreRender |
( |
| ) |
|
|
protectedvirtual |
Prepares the game for rendering in the game loop, specifically clearing the current window.
◆ Render()
virtual void VGame::Render |
( |
VCamera * |
camera | ) |
|
|
protectedvirtual |
Renders the game state, called for each camera currently active in a state.
- Parameters
-
camera | The current camera object being rendered to. |
◆ Run() [1/2]
int VGame::Run |
( |
const sf::String & |
title, |
|
|
VState * |
initialState, |
|
|
int |
windowwidth, |
|
|
int |
windowheight, |
|
|
float |
fps = 60 , |
|
|
int |
flags = sf::Style::Default , |
|
|
const sf::ContextSettings & |
settings = sf::ContextSettings() |
|
) |
| |
Runs a new game.
- Parameters
-
title | Window Title. |
initialState | First VState object to run the game with. Cannot be NULL. |
windowwidth | Width of the Game Window. |
windowheight | Height of the Game Window. |
fps | Framerate in Frames Per Second. |
flags | Window Style Flags using one or more of the sf::Style flags. Default = Titlebar | Resize | Close |
settings | OpenGL Context settings. Default = 0 Depth + 0 Stencil + Version 1.1 + Default Attributes + No sRGB |
- Returns
- An integer returning the result of the game. If 0, there were no errors.
◆ Run() [2/2]
int VGame::Run |
( |
const sf::String & |
title, |
|
|
VState * |
initialState, |
|
|
int |
windowwidth, |
|
|
int |
windowheight, |
|
|
int |
screenwidth, |
|
|
int |
screenheight, |
|
|
float |
fps = 60 , |
|
|
int |
flags = sf::Style::Default , |
|
|
const sf::ContextSettings & |
settings = sf::ContextSettings() |
|
) |
| |
Runs a new game.
- Parameters
-
title | Window Title. |
initialState | First VState object to run the game with. Cannot be NULL. |
windowwidth | Width of the Game Window. |
windowheight | Height of the Game Window. |
screenwidth | Width of the Game Screen. |
screenheight | Height of the Game Screen. |
fps | Framerate in Frames Per Second. |
flags | Window Style Flags using one or more of the sf::Style flags. Default = Titlebar | Resize | Close |
settings | OpenGL Context settings. Default = 0 Depth + 0 Stencil + Version 1.1 + Default Attributes + No sRGB |
- Returns
- An integer returning the result of the game. If 0, there were no errors.
◆ Update()
virtual void VGame::Update |
( |
float |
dt | ) |
|
|
protectedvirtual |
Runs the update stage of the game loop.
- Parameters
-
dt | Delta Time between the previous and current update. Value depends on whether VSync is enabled or not and what the fps value is set to. |
The documentation for this class was generated from the following file:
- D:/Development/Libs/Vigilante-Game-Framework/VFrame/VGame.h