r-type  0.0.0
R-Type main
Loading...
Searching...
No Matches
HUD.hpp
Go to the documentation of this file.
1///
2/// @file HUD.hpp
3/// @brief HUD System for managing score display and UI elements
4/// @namespace gme
5///
6
7#pragma once
8
11#include "Utils/Common.hpp"
12
13namespace gme
14{
15
16 class HUDSystem final : public ecs::ASystem
17 {
18 public:
19 explicit HUDSystem(const std::shared_ptr<eng::IRenderer> &renderer, ecs::Registry &registry)
20 : m_renderer(renderer), m_registry(registry)
21 {
22 createScoreHUD(m_registry, 10.0F, 10.0F);
23 }
24 ~HUDSystem() override = default;
25
26 HUDSystem(const HUDSystem &) = delete;
27 HUDSystem &operator=(const HUDSystem &) = delete;
28 HUDSystem(HUDSystem &&) = delete;
30
31 void update(ecs::Registry &registry, float /* dt */) override;
32
33 private:
34 void createScoreHUD(ecs::Registry &registry, float x, float y);
35 void updateScore(ecs::Registry &registry, int newScore) const;
36
37 const std::shared_ptr<eng::IRenderer> &m_renderer;
40 std::vector<ecs::Entity> m_scoreDigitEntities;
41 }; // class HUDSystem
42
43} // namespace gme
This file contains the IRenderer class declaration.
This file contains the interface for systems.
Abstract class for system.
Definition ISystems.hpp:34
Class for managing entities and their components.
Definition Registry.hpp:25
System responsible for rendering and updating the game's Heads-Up Display.
Definition HUD.hpp:17
void update(ecs::Registry &registry, float) override
ecs::Registry & m_registry
ECS registry reference.
Definition HUD.hpp:103
void updateScore(ecs::Registry &registry, int newScore) const
std::vector< ecs::Entity > m_scoreDigitEntities
Entities for individual score digits.
Definition HUD.hpp:105
HUDSystem & operator=(HUDSystem &&)=delete
HUDSystem(HUDSystem &&)=delete
HUDSystem & operator=(const HUDSystem &)=delete
const std::shared_ptr< eng::IRenderer > & m_renderer
Renderer for drawing HUD elements.
Definition HUD.hpp:102
ecs::Entity m_scoreBgEntity
Entity for score background sprite.
Definition HUD.hpp:104
HUDSystem(const HUDSystem &)=delete
~HUDSystem() override=default
void createScoreHUD(ecs::Registry &registry, float x, float y)
Create the score display HUD elements.
Definition HUD.cpp:7
HUDSystem(const std::shared_ptr< eng::IRenderer > &renderer, ecs::Registry &registry)
Definition HUD.hpp:19
This file contains common definitions and constants.
std::uint32_t Entity
Definition Entity.hpp:13