feat(layers): add layering system
This commit is contained in:
parent
d486da8994
commit
3b87746e7d
7
src/components/layer_component.h
Normal file
7
src/components/layer_component.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
struct LayerComponent {
|
||||||
|
int layer;
|
||||||
|
|
||||||
|
LayerComponent(int layer = 0) : layer(layer) {}
|
||||||
|
};
|
5
src/components/ui_component.cpp
Normal file
5
src/components/ui_component.cpp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
//
|
||||||
|
// Created by illyum on 9/12/2024.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "ui_component.h"
|
20
src/components/ui_component.h
Normal file
20
src/components/ui_component.h
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <functional>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
enum class UIState {
|
||||||
|
NORMAL,
|
||||||
|
HOVERED,
|
||||||
|
CLICKED
|
||||||
|
};
|
||||||
|
|
||||||
|
struct UIComponent {
|
||||||
|
std::string text;
|
||||||
|
float width;
|
||||||
|
float height;
|
||||||
|
std::function<void()> onClick;
|
||||||
|
UIState state = UIState::NORMAL;
|
||||||
|
|
||||||
|
UIComponent(std::string text, float width, float height, std::function<void()> onClick)
|
||||||
|
: text(std::move(text)), width(width), height(height), onClick(std::move(onClick)) {}
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user