![]() |
FastEngine 0.9.3
A multiplayer oriented 2D engine made with Vulkan.
|
A base class for all GUI elements. More...
#include <C_guiElement.hpp>
Public Types | |
using | Priority = uint8_t |
Public Member Functions | |
GuiElement (fge::GuiElement::Priority priority) | |
virtual bool | isRecursive () const |
Check if this GuiElement is recursive. | |
void | setGuiScale (fge::Vector2f const &scale) |
Set the scale of the element. | |
fge::Vector2f const & | getGuiScale () const |
Get the scale of the element. | |
void | setPriority (fge::GuiElement::Priority priority) const |
Set the priority of the element. | |
fge::GuiElement::Priority | getPriority () const |
Get the priority of the element. | |
bool | verifyPriority (fge::GuiElement *element) const |
Verify if the priority of the element is higher than the given element. | |
virtual void | onGuiVerify (fge::Event const &evt, SDL_EventType evtType, fge::GuiElementContext &context)=0 |
Function called to verify if the element is hovered by the mouse. | |
Static Public Member Functions | |
static void | setGlobalGuiScale (fge::Vector2f const &scale) |
static fge::Vector2f const & | getGlobalGuiScale () |
Public Attributes | |
fge::CallbackHandler< fge::Event const &, SDL_MouseWheelEvent const &, fge::GuiElementContext & > | _onGuiMouseWheelScrolled |
Callback called when the element is verified and the mouse wheel is scrolled. | |
fge::CallbackHandler< fge::Event const &, SDL_MouseButtonEvent const &, fge::GuiElementContext & > | _onGuiMouseButtonPressed |
Callback called when the element is verified and the mouse is pressed. | |
fge::CallbackHandler< fge::Event const &, SDL_MouseButtonEvent const &, fge::GuiElementContext & > | _onGuiMouseButtonReleased |
Callback called when the element is verified and a mouse button is released. | |
fge::CallbackHandler< fge::Event const &, SDL_MouseMotionEvent const &, fge::GuiElementContext & > | _onGuiMouseMoved |
Callback called when the element is verified and the mouse is moved. | |
Static Public Attributes | |
static fge::CallbackHandler< fge::Vector2f const & > | _onGlobalGuiScaleChange |
Protected Attributes | |
fge::GuiElement::Priority | _g_priority { 50 } |
fge::Vector2f | _g_scale {1.0f, 1.0f} |
A base class for all GUI elements.
A GUI element is a utility to handle mouse events by priority for superposed elements.
|
inlinenodiscard |
Get the scale of the element.
|
inlinenodiscard |
Get the priority of the element.
|
inlinenodiscardvirtual |
Check if this GuiElement is recursive.
A gui element is recursive if it handle others GuiElements.
Reimplemented in fge::GuiElementRecursive.
|
pure virtual |
Function called to verify if the element is hovered by the mouse.
This function should call verifyPriority to verify the priority of the element. If the priority is higher than the given element, the function should replace the provided pointer reference element with the element itself.
evt | An fge::Event |
evtType | The type of the SDL event called |
context | The GuiElement context |
Implemented in fge::GuiElementArray, fge::GuiElementDefault, and fge::GuiElementRectangle.
|
inline |
Set the scale of the element.
scale | The scale of the element |
|
inline |
Set the priority of the element.
The priority value can be used with the scene DepthPlan.
priority | The priority of the element |
|
inlinenodiscard |
Verify if the priority of the element is higher than the given element.
If the provided element is null, the function will assume that the element is the highest priority.
element | The element to compare with |
fge::CallbackHandler<fge::Event const&, SDL_MouseButtonEvent const&, fge::GuiElementContext&> fge::GuiElement::_onGuiMouseButtonPressed |
Callback called when the element is verified and the mouse is pressed.
fge::CallbackHandler<fge::Event const&, SDL_MouseButtonEvent const&, fge::GuiElementContext&> fge::GuiElement::_onGuiMouseButtonReleased |
Callback called when the element is verified and a mouse button is released.
fge::CallbackHandler<fge::Event const&, SDL_MouseMotionEvent const&, fge::GuiElementContext&> fge::GuiElement::_onGuiMouseMoved |
Callback called when the element is verified and the mouse is moved.
fge::CallbackHandler<fge::Event const&, SDL_MouseWheelEvent const&, fge::GuiElementContext&> fge::GuiElement::_onGuiMouseWheelScrolled |
Callback called when the element is verified and the mouse wheel is scrolled.