Cogs.Core
GuiSystem.h
1#pragma once
2
3#include "GuiComponent.h"
4
5#include "Systems/ComponentSystem.h"
6
7#include "GuiDocument.h"
8#include "GuiContainer.h"
9
10namespace Cogs
11{
12 namespace Core
13 {
14 struct GuiData
15 {
16 ~GuiData();
17
18 litehtml::document::ptr htmlDocument;
19 std::string theme;
20
21 glm::vec2 size;
22
23 float pointerX;
24 float pointerY;
25
26 float lastX = 0.0f;
27 float lastY = 0.0f;
28
29 bool pointerInside;
30 bool pointerRelative;
31
32 bool pointerState;
33 bool pointerDown;
34 bool pointerUp;
35 bool invalidated;
36 };
37
38 class GuiSystem : public ComponentSystemWithDataPool<GuiComponent, GuiData>
39 {
40 public:
41 GuiSystem(Memory::Allocator * allocator, SizeType capacity) : ComponentSystemWithDataPool(allocator, capacity) {}
42 ~GuiSystem();
43
44 virtual void update(Context * context) override;
45 void updateInputs(const GuiComponent & guiComponent, GuiData & guiData);
46
47 private:
48 using ThemeMap = std::map<std::string, litehtml::css*>;
49
50 ThemeMap themes;
51 };
52 }
53}
Context * context
Pointer to the Context instance the system lives in.
void update()
Updates the system state to that of the current frame.
Component system with parallel data per component stored in a pool similar to how the components them...
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
Base allocator implementation.
Definition: Allocator.h:30
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
ComponentIndex SizeType
Type used to track the size of pools.
Definition: Component.h:19