Crimson Engine 1.0.0
A high-performance C++20 game engine prototype showcasing a custom ECS, Vulkan renderer, and ImGui editor.
Loading...
Searching...
No Matches
UISystem.hpp
Go to the documentation of this file.
1#pragma once
2#include "ecs/System.hpp"
3#include "ecs/Registry.hpp"
6#include <imgui.h>
7
8namespace Engine {
9
10 class UISystem : public System {
11 public:
13 : registry(reg), renderer(rend) {}
14
15 void setEditorActive(bool active) { editorActive = active; }
16 void setPlaying(bool playing) { isPlaying = playing; }
17
18 void update(float dt) override {
19 // Reset click states of all buttons at the start of the frame
20 for (auto [ent, btn] : registry.view<UIButtonComponent>()) {
21 btn.isClicked = false;
22 }
23 }
24
28 void draw();
29
30 private:
33 bool editorActive = false;
34 bool isPlaying = false;
35
36 glm::vec4 getRect(Entity entity, const glm::vec2& viewportSize);
37 void drawWidget(Entity entity, const glm::vec2& viewportPos, const glm::vec2& viewportSize, ImDrawList* drawList);
38 };
39
40} // namespace Engine
void setPlaying(bool playing)
Definition UISystem.hpp:16
bool isPlaying
Definition UISystem.hpp:34
void update(float dt) override
Pure virtual update function to implement system behaviors.
Definition UISystem.hpp:18
void draw()
Renders the UI overlay.
Definition UISystem.cpp:10
VulkanRenderer & renderer
Definition UISystem.hpp:32
void drawWidget(Entity entity, const glm::vec2 &viewportPos, const glm::vec2 &viewportSize, ImDrawList *drawList)
Definition UISystem.cpp:68
void setEditorActive(bool active)
Definition UISystem.hpp:15
bool editorActive
Definition UISystem.hpp:33
UISystem(Registry &reg, VulkanRenderer &rend)
Definition UISystem.hpp:12
glm::vec4 getRect(Entity entity, const glm::vec2 &viewportSize)
Definition UISystem.cpp:341
Registry & registry
Definition UISystem.hpp:31
Lightweight identifier representing a game object in the Entity Component System.
Definition Entity.hpp:11
Coordinates entities and components, providing creation, removal, lookup, and views.
Definition Registry.hpp:30
Base class for ECS systems that process sets of entities.
Definition System.hpp:12
Manages core Vulkan pipeline states, device interaction, frames, buffers, and command submissions.
Definition VulkanRenderer.hpp:127
Definition Application.hpp:16
Definition UIComponents.hpp:58