Crimson Engine
1.0.0
A high-performance C++20 game engine prototype showcasing a custom ECS, Vulkan renderer, and ImGui editor.
Toggle main menu visibility
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
"
4
#include "
renderer/VulkanRenderer.hpp
"
5
#include "
ecs/components/UIComponents.hpp
"
6
#include <imgui.h>
7
8
namespace
Engine
{
9
10
class
UISystem
:
public
System
{
11
public
:
12
UISystem
(
Registry
& reg,
VulkanRenderer
& rend)
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
:
31
Registry
&
registry
;
32
VulkanRenderer
&
renderer
;
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
Registry.hpp
System.hpp
UIComponents.hpp
VulkanRenderer.hpp
Engine::UISystem::setPlaying
void setPlaying(bool playing)
Definition
UISystem.hpp:16
Engine::UISystem::isPlaying
bool isPlaying
Definition
UISystem.hpp:34
Engine::UISystem::update
void update(float dt) override
Pure virtual update function to implement system behaviors.
Definition
UISystem.hpp:18
Engine::UISystem::draw
void draw()
Renders the UI overlay.
Definition
UISystem.cpp:10
Engine::UISystem::renderer
VulkanRenderer & renderer
Definition
UISystem.hpp:32
Engine::UISystem::drawWidget
void drawWidget(Entity entity, const glm::vec2 &viewportPos, const glm::vec2 &viewportSize, ImDrawList *drawList)
Definition
UISystem.cpp:68
Engine::UISystem::setEditorActive
void setEditorActive(bool active)
Definition
UISystem.hpp:15
Engine::UISystem::editorActive
bool editorActive
Definition
UISystem.hpp:33
Engine::UISystem::UISystem
UISystem(Registry ®, VulkanRenderer &rend)
Definition
UISystem.hpp:12
Engine::UISystem::getRect
glm::vec4 getRect(Entity entity, const glm::vec2 &viewportSize)
Definition
UISystem.cpp:341
Engine::UISystem::registry
Registry & registry
Definition
UISystem.hpp:31
Entity
Lightweight identifier representing a game object in the Entity Component System.
Definition
Entity.hpp:11
Registry
Coordinates entities and components, providing creation, removal, lookup, and views.
Definition
Registry.hpp:30
System
Base class for ECS systems that process sets of entities.
Definition
System.hpp:12
VulkanRenderer
Manages core Vulkan pipeline states, device interaction, frames, buffers, and command submissions.
Definition
VulkanRenderer.hpp:127
Engine
Definition
Application.hpp:16
Engine::UIButtonComponent
Definition
UIComponents.hpp:58
engine
include
ecs
systems
UISystem.hpp
Generated by
1.17.0