dEngine
Simple 2D C++ game engine
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
dengine_UI::UIComponent Class Referenceabstract

A component of a UI window. More...

#include <UIComponent.h>

Inheritance diagram for dengine_UI::UIComponent:
dengine_UI::Circle dengine_UI::FilledCircle dengine_UI::HollowRect dengine_UI::ProgressBarH dengine_UI::ProgressBarV dengine_UI::RoundedBox dengine_UI::Text

Public Member Functions

virtual void Render ()=0
 The render method of a component. More...
 
virtual void Update ()=0
 The update method of a component. More...
 
void SetDrawColor (SDL_Color color)
 Set Draw Color. More...
 

Protected Member Functions

std::string GetVar (std::string key)
 

Protected Attributes

SDL_Color drawColor
 

Detailed Description

A component of a UI window.

This is a base level component that by itself does nothing. This should be used as a building block for other UI components. UI components are meant to be added to UIWindows and will be rendered from there.

See also
UIWindow

Member Function Documentation

◆ GetVar()

std::string dengine_UI::UIComponent::GetVar ( std::string  key)
protected

Referenced by SetDrawColor().

◆ Render()

virtual void dengine_UI::UIComponent::Render ( )
pure virtual

The render method of a component.

During the render phase of the program, this function is what draws the component to the screen. This should be overridden for any UIComponents and actually be used to draw to the screen using one of the many SDL_Render functions available.

Implemented in dengine_UI::ProgressBarH, dengine_UI::Text, dengine_UI::HollowRect, dengine_UI::ProgressBarV, dengine_UI::Circle, dengine_UI::FilledCircle, and dengine_UI::RoundedBox.

◆ SetDrawColor()

void dengine_UI::UIComponent::SetDrawColor ( SDL_Color  color)
inline

Set Draw Color.

Sets the draw color of the component

Parameters
colorThe color to draw the UI component in

◆ Update()

virtual void dengine_UI::UIComponent::Update ( )
pure virtual

The update method of a component.

During the update phase of the program, this function is what updates and performs any logic within the component. This should be overridden for any UIComponents and actually be used to Update the internal logic of the component. This is called prior to the update anywhere else within the engine.

Implemented in dengine_UI::ProgressBarH, dengine_UI::Text, dengine_UI::HollowRect, dengine_UI::ProgressBarV, dengine_UI::Circle, dengine_UI::FilledCircle, and dengine_UI::RoundedBox.

Member Data Documentation

◆ drawColor

SDL_Color dengine_UI::UIComponent::drawColor
protected

Referenced by SetDrawColor().