From 3b87746e7ddd5c39453aa0dcc42592de8d8d952e Mon Sep 17 00:00:00 2001 From: illyum Date: Thu, 12 Sep 2024 21:11:27 -0600 Subject: [PATCH] feat(layers): add layering system --- src/components/layer_component.h | 7 +++++++ src/components/ui_component.cpp | 5 +++++ src/components/ui_component.h | 20 ++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 src/components/layer_component.h create mode 100644 src/components/ui_component.cpp create mode 100644 src/components/ui_component.h diff --git a/src/components/layer_component.h b/src/components/layer_component.h new file mode 100644 index 0000000..5e8e6ea --- /dev/null +++ b/src/components/layer_component.h @@ -0,0 +1,7 @@ +#pragma once + +struct LayerComponent { + int layer; + + LayerComponent(int layer = 0) : layer(layer) {} +}; diff --git a/src/components/ui_component.cpp b/src/components/ui_component.cpp new file mode 100644 index 0000000..b8bee2c --- /dev/null +++ b/src/components/ui_component.cpp @@ -0,0 +1,5 @@ +// +// Created by illyum on 9/12/2024. +// + +#include "ui_component.h" diff --git a/src/components/ui_component.h b/src/components/ui_component.h new file mode 100644 index 0000000..a34acd0 --- /dev/null +++ b/src/components/ui_component.h @@ -0,0 +1,20 @@ +#pragma once +#include +#include + +enum class UIState { + NORMAL, + HOVERED, + CLICKED +}; + +struct UIComponent { + std::string text; + float width; + float height; + std::function onClick; + UIState state = UIState::NORMAL; + + UIComponent(std::string text, float width, float height, std::function onClick) + : text(std::move(text)), width(width), height(height), onClick(std::move(onClick)) {} +}; \ No newline at end of file