dEngine
Simple 2D C++ game engine
Public Member Functions | Private Attributes | List of all members
dengine_UI::UI Class Reference

Used to manage the UI of a game See the code example below for a quick reference on how to use the UI. More...

#include <UI.h>

Public Member Functions

 UI ()
 Constructor. More...
 
void Load ()
 Load the UI. More...
 
void Render ()
 Render the UI. More...
 
void Update ()
 Render the UI. More...
 
void Push (UIWindow *window)
 Push window to stack. More...
 
void Pop ()
 Pop a UI window from the stack. More...
 

Private Attributes

std::vector< UIWindow * > windows
 

Detailed Description

Used to manage the UI of a game See the code example below for a quick reference on how to use the UI.

UIWindow* uiwindow = new UIWindow();
Circle* circle = new Circle();
circle->Setup({200,250},80);
FilledCircle* filledcircle = new FilledCircle();
filledcircle->Setup({290,250},80);
uiwindow->Push(circle);
uiwindow->Push(filledcircle);
Game::GetInstance().GetUI()->Push(uiwindow);

Constructor & Destructor Documentation

◆ UI()

UI::UI ( )

Constructor.

Create a new UI

Member Function Documentation

◆ Load()

void UI::Load ( )

Load the UI.

Called in the Load stage of a game. Used for loading the UI into memory

◆ Pop()

void UI::Pop ( )

Pop a UI window from the stack.

Removes the last added UI window from the stack

◆ Push()

void UI::Push ( UIWindow window)

Push window to stack.

Push a new UI window onto the stack

Parameters
windowThe window to add to the stack

◆ Render()

void UI::Render ( )

Render the UI.

Renders the UI to the screen. Called in the Render stage of the game and is rendered after all GameObjects and their components.

Referenced by dengine::Game::loop().

◆ Update()

void UI::Update ( )

Render the UI.

Calls the Update function for the UI. Called in the Update stage of the game and is ran before all GameObjects and their components.

Referenced by dengine::Game::loop().

Member Data Documentation

◆ windows

std::vector<UIWindow*> dengine_UI::UI::windows
private

Referenced by Pop(), Push(), Render(), and Update().