System responsible for rendering and updating the game's Heads-Up Display. More...
#include <HUD.hpp>
Inheritance diagram for gme::HUDSystem:
Collaboration diagram for gme::HUDSystem:Public Member Functions | |
| HUDSystem (const std::shared_ptr< eng::IRenderer > &renderer, ecs::Registry ®istry) | |
| Constructor - initializes the HUD system and creates initial UI elements. | |
| ~HUDSystem () override=default | |
| Destructor. | |
| HUDSystem (const HUDSystem &)=delete | |
| Deleted copy constructor (non-copyable) | |
| HUDSystem & | operator= (const HUDSystem &)=delete |
| Deleted copy assignment operator (non-copyable) | |
| HUDSystem (HUDSystem &&)=delete | |
| Deleted move constructor (non-movable) | |
| HUDSystem & | operator= (HUDSystem &&)=delete |
| Deleted move assignment operator (non-movable) | |
| void | update (ecs::Registry ®istry, float) override |
| Update the HUD system (called each frame) | |
| HUDSystem (const std::shared_ptr< eng::IRenderer > &renderer, ecs::Registry ®istry) | |
| ~HUDSystem () override=default | |
| HUDSystem (const HUDSystem &)=delete | |
| HUDSystem & | operator= (const HUDSystem &)=delete |
| HUDSystem (HUDSystem &&)=delete | |
| HUDSystem & | operator= (HUDSystem &&)=delete |
| void | update (ecs::Registry ®istry, float) override |
Public Member Functions inherited from ecs::ASystem | |
| bool | isEnable () override |
| void | setEnable (const bool enable) override |
Public Member Functions inherited from ecs::ISystem | |
| virtual | ~ISystem ()=default |
Private Member Functions | |
| void | createScoreHUD (ecs::Registry ®istry, float x, float y) |
| Create the score display HUD elements. | |
| void | updateScore (ecs::Registry ®istry, int newScore) const |
| Update the displayed score value. | |
| void | createScoreHUD (ecs::Registry ®istry, float x, float y) |
| void | updateScore (ecs::Registry ®istry, int newScore) const |
Private Attributes | |
| const std::shared_ptr< eng::IRenderer > & | m_renderer |
| Renderer for drawing HUD elements. | |
| ecs::Registry & | m_registry |
| ECS registry reference. | |
| ecs::Entity | m_scoreBgEntity {} |
| Entity for score background sprite. | |
| std::vector< ecs::Entity > | m_scoreDigitEntities |
| Entities for individual score digits. | |
System responsible for rendering and updating the game's Heads-Up Display.
This ECS system manages all HUD elements including:
The HUD is created at initialization and updated each frame to reflect the current game state. It uses sprite-based rendering for visual elements.
|
inlineexplicit |
Constructor - initializes the HUD system and creates initial UI elements.
| renderer | Shared pointer to the renderer for drawing UI elements |
| registry | Reference to the ECS registry for entity management |
Automatically creates the score HUD at position (10, 10) upon construction
Definition at line 43 of file HUD.hpp.
References createScoreHUD(), and m_registry.
Here is the call graph for this function:
|
overridedefault |
Destructor.
|
delete |
Deleted copy constructor (non-copyable)
|
delete |
Deleted move constructor (non-movable)
|
inlineexplicit |
Definition at line 19 of file HUD.hpp.
References createScoreHUD(), and m_registry.
Here is the call graph for this function:
|
overridedefault |
|
delete |
|
delete |
|
private |
Create the score display HUD elements.
| registry | ECS registry for creating entities |
| x | X-coordinate for the score display position |
| y | Y-coordinate for the score display position |
Creates background and digit entities for the score display. Initializes the visual representation of the player's score.
Definition at line 7 of file HUD.cpp.
References ecs::Registry::createEntity(), m_scoreBgEntity, m_scoreDigitEntities, utl::Path::Texture::TEXTURE_SCORE_COUNTER_BG, utl::Path::Texture::TEXTURE_SCORE_DIGIT_0, and ecs::Registry::EntityBuilder::with().
Referenced by HUDSystem().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Deleted copy assignment operator (non-copyable)
Deleted move assignment operator (non-movable)
|
overridevirtual |
Update the HUD system (called each frame)
| registry | ECS registry containing all entities and components |
| dt | Delta time (unused in current implementation) |
Updates score display and other HUD elements based on current game state
Implements ecs::ISystem.
Definition at line 64 of file HUD.cpp.
References ecs::Registry::getAll().
Here is the call graph for this function:
|
overridevirtual |
Implements ecs::ISystem.
|
private |
Update the displayed score value.
| registry | ECS registry containing score entities |
| newScore | New score value to display |
Updates the sprite indices of digit entities to reflect the new score. Handles score formatting and digit separation.
Definition at line 29 of file HUD.cpp.
References ecs::Registry::getComponent(), utl::Path::Texture::TEXTURE_SCORE_DIGIT_0, utl::Path::Texture::TEXTURE_SCORE_DIGIT_1, utl::Path::Texture::TEXTURE_SCORE_DIGIT_2, utl::Path::Texture::TEXTURE_SCORE_DIGIT_3, utl::Path::Texture::TEXTURE_SCORE_DIGIT_4, utl::Path::Texture::TEXTURE_SCORE_DIGIT_5, utl::Path::Texture::TEXTURE_SCORE_DIGIT_6, utl::Path::Texture::TEXTURE_SCORE_DIGIT_7, utl::Path::Texture::TEXTURE_SCORE_DIGIT_8, utl::Path::Texture::TEXTURE_SCORE_DIGIT_9, and ecs::Transform::x.
Here is the call graph for this function:
|
private |
|
private |
|
private |
|
private |
Entity for score background sprite.
Definition at line 104 of file HUD.hpp.
Referenced by createScoreHUD().
|
private |
Entities for individual score digits.
Definition at line 105 of file HUD.hpp.
Referenced by createScoreHUD().