AireEngine
A 3D Open-World Game Engine
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
Aire::HUD Class Reference

Class to render HUD elements on the screen. More...

#include <hud.h>

Classes

struct  HUD_IMAGE
 
struct  HUD_PROGRESS_BAR
 
struct  HUD_TEXT
 Class to display text on the screen. More...
 

Public Member Functions

 HUD (Window *window)
 
 ~HUD ()=default
 HUD manager destructor.
 
HUD_IMAGENewHUDImage (std::string name, glm::vec2 position, glm::vec2 scale, float rotation, Texture *texture)
 
HUD_PROGRESS_BARNewHUDProgressBar (std::string name, glm::vec2 position, glm::vec2 scale, float rotation, Texture *underTexture, Texture *progressTexture, float minValue, float maxValue, float value)
 
HUD_TEXTNewHUDText (std::string name, glm::vec2 position, glm::vec2 scale, float rotation, std::string textContent, glm::vec3 colour)
 
HUD_IMAGEGetHUDImageByName (const std::string &name)
 
HUD_PROGRESS_BARGetHUDProgressBarByName (const std::string &name)
 
HUD_TEXTGetHUDTextByName (const std::string &name)
 
void RemoveHUDImage (HUD_IMAGE *imageToRemove)
 
void RemoveHUDProgressBar (HUD_PROGRESS_BAR *progressBarToRemove)
 
void RemoveHUDText (HUD_TEXT *textToRemove)
 
void Render ()
 Renders all active HUD elements.
 
void LoadFont (const char *filePath, int fontSize)
 

Detailed Description

Class to render HUD elements on the screen.

Constructor & Destructor Documentation

◆ HUD()

HUD::HUD ( Window * window)

Creates the main HUD manager. All further HUD elements exist within the context of this object.

Parameters
windowobject associated with the OpenGL context
Here is the call graph for this function:

Member Function Documentation

◆ GetHUDImageByName()

HUD::HUD_IMAGE * HUD::GetHUDImageByName ( const std::string & name)

Retrieves a HUD IMAGE element by name

Parameters
nameUnique name of the element
Returns
HUD_IMAGE* pointer to the element if found

◆ GetHUDProgressBarByName()

HUD::HUD_PROGRESS_BAR * HUD::GetHUDProgressBarByName ( const std::string & name)

Retrieves a HUD PROGRESS BAR element by name

Parameters
nameUnique name of the element
Returns
HUD_PROGRESS_BAR* pointer to the element if found

◆ GetHUDTextByName()

HUD::HUD_TEXT * HUD::GetHUDTextByName ( const std::string & name)

Retrieves a HUD TEXT element by name

Parameters
nameUnique name of the element
Returns
HUD_TEXT* pointer to the element if found

◆ LoadFont()

void HUD::LoadFont ( const char * filePath,
int fontSize )

Loads a .ttf font. Used for rendering all text HUD elements. (Only one font can be loaded at a time)

Parameters
filePathpath to the .ttf font asset file
fontSizesize of the font
Here is the caller graph for this function:

◆ NewHUDImage()

HUD::HUD_IMAGE * HUD::NewHUDImage ( std::string name,
glm::vec2 position,
glm::vec2 scale,
float rotation,
Texture * texture )

Creates a new HUD Image element. Will be rendered as long as it exists and its "Active" param is set to true.

Parameters
nameName for the element. Can be used for retrieval and deletion later.
positionPosition on the screen
scaleScale of the element
rotationRotation of the element, in degrees
textureTexture to render
Returns
HUD_IMAGE* pointer to the created HUD IMAGE element
Here is the call graph for this function:

◆ NewHUDProgressBar()

HUD::HUD_PROGRESS_BAR * HUD::NewHUDProgressBar ( std::string name,
glm::vec2 position,
glm::vec2 scale,
float rotation,
Texture * underTexture,
Texture * progressTexture,
float minValue,
float maxValue,
float value )

Creates a new HUD Progress Bar element. Will be rendered as long as it exists and its "Active" param is set to true.

Parameters
nameName for the element. Can be used for retrieval and deletion later.
positionPosition on the screen
scaleScale of the element
rotationRotation of the element
underTextureTexture rendered (always in full) underneath the actual progress bar
progressTextureTexture which will be rendered and scaled according to the "value" parameter
minValueThe lowest possible value the progress bar can represent
maxValueThe highest possible value the progress bar can represent
valueThe current value of the progress bar (should be between the minValue and maxValue)
Returns
HUD_PROGRESS_BAR* pointer to the created HUD PROGRESS BAR element
Here is the call graph for this function:

◆ NewHUDText()

HUD::HUD_TEXT * HUD::NewHUDText ( std::string name,
glm::vec2 position,
glm::vec2 scale,
float rotation,
std::string textContent,
glm::vec3 colour )

Creates a new HUD text element. Will be rendered as long as it exists and its "Active" param is set to true.

Parameters
nameName for the element. Can be used for retrieval and deletion later.
positionPosition on the screen
scaleScale of the element
rotationRotation of the element
textContentThe actual text content to be rendered
colourSets the colour of the text when rendered
Returns
HUD_TEXT* pointer to the created HUD TEXT element
Here is the caller graph for this function:

◆ RemoveHUDImage()

void HUD::RemoveHUDImage ( HUD_IMAGE * imageToRemove)

Deletes a HUD_IMAGE element

Parameters
imageToRemoveHUD_IMAGE* pointer to the element to be deleted

◆ RemoveHUDProgressBar()

void HUD::RemoveHUDProgressBar ( HUD_PROGRESS_BAR * progressBarToRemove)

Deletes a HUD_PROGRESS_BAR element

Parameters
progressBarToRemoveHUD_PROGRESS_BAR* pointer to the element to be deleted

◆ RemoveHUDText()

void HUD::RemoveHUDText ( HUD_TEXT * textToRemove)

Deletes a HUD_TEXT element

Parameters
textToRemoveHUD_TEXT* pointer to the element to be deleted

The documentation for this class was generated from the following files: