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

UI window Meant to be a collection of related UIComponents to display at the same time. This can be a menu, a HUD, or anything else where you want multiple elements displayed at once. This will then be "Pushed" to the UI to be displayed. See the code example below for a quick reference on how to use the UIWindow with UIComponent and the UI. More...

#include <UIWindow.h>

Public Member Functions

void Push (UIComponent *)
 Push a component onto the stack. More...
 
void Pop ()
 Pop a UI element from the stack. More...
 
virtual void Render ()
 Render function. More...
 
virtual void Update ()
 Update function. More...
 

Private Attributes

std::vector< class UIComponent * > components
 

Detailed Description

UI window Meant to be a collection of related UIComponents to display at the same time. This can be a menu, a HUD, or anything else where you want multiple elements displayed at once. This will then be "Pushed" to the UI to be displayed. See the code example below for a quick reference on how to use the UIWindow with UIComponent and 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);
See also
UIComponent

Member Function Documentation

◆ Pop()

void UIWindow::Pop ( )

Pop a UI element from the stack.

Removes the last UIComponent added from the stack

◆ Push()

void UIWindow::Push ( UIComponent component)

Push a component onto the stack.

Adds a new UIComponent to the stack. The stack is a FILO system and as such the last component added will be draw on top. If you layer UIComponents be mindful of the order they are pushed.

◆ Render()

void UIWindow::Render ( )
virtual

Render function.

Renders all components on the stack

◆ Update()

void UIWindow::Update ( )
virtual

Update function.

Update all components on the stack

Member Data Documentation

◆ components

std::vector<class UIComponent *> dengine_UI::UIWindow::components
private

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