R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
IMenu.hpp
Go to the documentation of this file.
1
/*
2
** EPITECH PROJECT, 2025
3
** r-type
4
** File description:
5
** IMenu - Abstract menu interface for UI system
6
*/
7
8
#pragma once
9
10
#include <memory>
11
#include <string>
12
#include <vector>
13
14
namespace
UI
{
15
// Forward declaration
16
class
IButton;
17
29
class
IMenu
{
30
public
:
32
virtual
~IMenu
() =
default
;
33
38
virtual
void
Update
() = 0;
39
44
virtual
void
Render
() = 0;
45
50
virtual
void
AddButton
(std::shared_ptr<IButton> button) = 0;
51
56
virtual
void
RemoveButton
(
size_t
index) = 0;
57
63
virtual
std::shared_ptr<IButton>
GetButton
(
size_t
index) = 0;
64
69
[[nodiscard]]
virtual
size_t
GetButtonCount
()
const
= 0;
70
74
virtual
void
Clear
() = 0;
75
80
virtual
void
SetVisible
(
bool
visible) = 0;
81
86
[[nodiscard]]
virtual
bool
IsVisible
()
const
= 0;
87
88
// ===== Keyboard Navigation =====
89
94
virtual
void
HandleKeyboardNavigation
() = 0;
95
100
virtual
void
SelectNext
() = 0;
101
106
virtual
void
SelectPrevious
() = 0;
107
111
virtual
void
TriggerSelected
() = 0;
112
117
[[nodiscard]]
virtual
int
GetSelectedIndex
()
const
= 0;
118
123
virtual
void
SetSelectedIndex
(
int
index) = 0;
124
};
125
}
// namespace UI
UI::IMenu
Abstract interface for UI menus.
Definition
IMenu.hpp:29
UI::IMenu::GetButton
virtual std::shared_ptr< IButton > GetButton(size_t index)=0
Get a button by index.
UI::IMenu::IsVisible
virtual bool IsVisible() const =0
Check menu visibility.
UI::IMenu::GetSelectedIndex
virtual int GetSelectedIndex() const =0
Get the index of the currently selected element.
UI::IMenu::Update
virtual void Update()=0
Update all menu elements.
UI::IMenu::~IMenu
virtual ~IMenu()=default
Virtual destructor.
UI::IMenu::Clear
virtual void Clear()=0
Remove all buttons from the menu.
UI::IMenu::SetSelectedIndex
virtual void SetSelectedIndex(int index)=0
Set the selected element by index.
UI::IMenu::TriggerSelected
virtual void TriggerSelected()=0
Trigger the currently selected element (simulate click).
UI::IMenu::HandleKeyboardNavigation
virtual void HandleKeyboardNavigation()=0
Handle keyboard navigation input.
UI::IMenu::Render
virtual void Render()=0
Render all menu elements.
UI::IMenu::SetVisible
virtual void SetVisible(bool visible)=0
Set menu visibility.
UI::IMenu::GetButtonCount
virtual size_t GetButtonCount() const =0
Get the number of buttons in the menu.
UI::IMenu::SelectNext
virtual void SelectNext()=0
Select the next navigable element.
UI::IMenu::RemoveButton
virtual void RemoveButton(size_t index)=0
Remove a button from the menu by index.
UI::IMenu::SelectPrevious
virtual void SelectPrevious()=0
Select the previous navigable element.
UI::IMenu::AddButton
virtual void AddButton(std::shared_ptr< IButton > button)=0
Add a button to the menu.
UI
Definition
IButton.hpp:13
client
UI
IMenu.hpp
Generated by
1.9.8