Air-Trap 1.0.0
A multiplayer R-Type clone game engine built with C++23 and ECS architecture
Loading...
Searching...
No Matches
rtp::ecs::components::ui::Button Struct Reference

Component representing a clickable button. More...

#include <Button.hpp>

Collaboration diagram for rtp::ecs::components::ui::Button:

Public Attributes

std::string text
 Text displayed on the button.
 
Vec2f position
 Position of the button.
 
Vec2f size
 Size of the button.
 
ButtonState state {ButtonState::Idle}
 Current state.
 
std::function< void()> onClick
 Callback when clicked.
 
uint8_t idleColor [3] {100, 100, 100}
 RGB color when idle.
 
uint8_t hoverColor [3] {150, 150, 150}
 RGB color when hovered.
 
uint8_t pressedColor [3] {50, 50, 50}
 RGB color when pressed.
 

Detailed Description

Component representing a clickable button.

Definition at line 30 of file Button.hpp.

Member Data Documentation

◆ hoverColor

uint8_t rtp::ecs::components::ui::Button::hoverColor[3] {150, 150, 150}

RGB color when hovered.

Definition at line 39 of file Button.hpp.

Referenced by rtp::client::scenes::LobbyScene::buildUi(), and rtp::client::scenes::MenuScene::onEnter().

◆ idleColor

uint8_t rtp::ecs::components::ui::Button::idleColor[3] {100, 100, 100}

RGB color when idle.

Definition at line 38 of file Button.hpp.

Referenced by rtp::client::scenes::LobbyScene::buildUi(), and rtp::client::scenes::MenuScene::onEnter().

◆ onClick

std::function<void()> rtp::ecs::components::ui::Button::onClick

Callback when clicked.

Definition at line 35 of file Button.hpp.

Referenced by rtp::client::graphics::UiFactory::createButton().

◆ position

Vec2f rtp::ecs::components::ui::Button::position

Position of the button.

Definition at line 32 of file Button.hpp.

Referenced by rtp::client::graphics::UiFactory::createButton(), and rtp::client::UISystem::isMouseOverButton().

◆ pressedColor

uint8_t rtp::ecs::components::ui::Button::pressedColor[3] {50, 50, 50}

RGB color when pressed.

Definition at line 40 of file Button.hpp.

Referenced by rtp::client::scenes::LobbyScene::buildUi(), and rtp::client::scenes::MenuScene::onEnter().

◆ size

Vec2f rtp::ecs::components::ui::Button::size

Size of the button.

Definition at line 33 of file Button.hpp.

Referenced by rtp::client::graphics::UiFactory::createButton(), and rtp::client::UISystem::isMouseOverButton().

◆ state

ButtonState rtp::ecs::components::ui::Button::state {ButtonState::Idle}

Current state.

Definition at line 34 of file Button.hpp.

Referenced by rtp::client::UISystem::handleMouseMove().

◆ text

std::string rtp::ecs::components::ui::Button::text

Text displayed on the button.

Definition at line 31 of file Button.hpp.

Referenced by rtp::client::graphics::UiFactory::createButton().


The documentation for this struct was generated from the following file: