Air-Trap 1.0.0
A multiplayer R-Type clone game engine built with C++23 and ECS architecture
Loading...
Searching...
No Matches
Button.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2025
3** Air-Trap
4** File description:
5** Button
6*/
7
8#pragma once
9
10#include <functional>
11#include <string>
12#include "RType/Math/Vec2.hpp"
13
15
20enum class ButtonState {
21 Idle,
22 Hovered,
24};
25
30struct Button {
31 std::string text;
35 std::function<void()> onClick;
37 // Visual properties
38 uint8_t idleColor[3]{100, 100, 100};
39 uint8_t hoverColor[3]{150, 150, 150};
40 uint8_t pressedColor[3]{50, 50, 50};
41};
42
43} // namespace rtp::ecs::components::ui
Declaration of the 2-dimensional vector class.
File : SpritePreview.hpp License: MIT Author : GitHub Copilot Date : 14/01/2026.
Definition Button.hpp:14
ButtonState
State of a button (idle, hovered, pressed)
Definition Button.hpp:20
Component representing a clickable button.
Definition Button.hpp:30
std::string text
Text displayed on the button.
Definition Button.hpp:31
std::function< void()> onClick
Callback when clicked.
Definition Button.hpp:35
ButtonState state
Current state.
Definition Button.hpp:34
Vec2f position
Position of the button.
Definition Button.hpp:32
Vec2f size
Size of the button.
Definition Button.hpp:33
uint8_t idleColor[3]
RGB color when idle.
Definition Button.hpp:38
uint8_t pressedColor[3]
RGB color when pressed.
Definition Button.hpp:40
uint8_t hoverColor[3]
RGB color when hovered.
Definition Button.hpp:39