FastEngine 0.9.3
A multiplayer oriented 2D engine made with Vulkan.
Loading...
Searching...
No Matches
fge::GuiElementArray Class Reference

A GUI element that verify a list of GUI elements. More...

#include <C_guiElement.hpp>

Inheritance diagram for fge::GuiElementArray:
fge::GuiElementRecursive fge::GuiElement

Public Types

using Priority = uint8_t
 

Public Member Functions

 GuiElementArray (fge::GuiElement::Priority priority)
 
void onGuiVerify (fge::Event const &evt, SDL_EventType evtType, fge::GuiElementContext &context) override
 Function called to verify if the element is hovered by the mouse.
 
bool isRecursive () const final
 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.
 

Static Public Member Functions

static void setGlobalGuiScale (fge::Vector2f const &scale)
 
static fge::Vector2f const & getGlobalGuiScale ()
 

Public Attributes

fge::Tunnel< fge::GuiElement_elements
 
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 Member Functions

void verifyRecursively (fge::Event const &evt, SDL_EventType evtType, fge::GuiElementContext &context) const
 

Protected Attributes

fge::GuiElement::Priority _g_priority { 50 }
 
fge::Vector2f _g_scale {1.0f, 1.0f}
 

Detailed Description

A GUI element that verify a list of GUI elements.

Member Function Documentation

◆ getGuiScale()

fge::Vector2f const & fge::GuiElement::getGuiScale ( ) const
inlinenodiscardinherited

Get the scale of the element.

Returns
The scale of the element

◆ getPriority()

fge::GuiElement::Priority fge::GuiElement::getPriority ( ) const
inlinenodiscardinherited

Get the priority of the element.

Returns
The priority of the element

◆ isRecursive()

bool fge::GuiElementRecursive::isRecursive ( ) const
inlinefinalvirtualinherited

Check if this GuiElement is recursive.

A gui element is recursive if it handle others GuiElements.

Returns
true if it is recursive, false otherwise

Reimplemented from fge::GuiElement.

◆ onGuiVerify()

void fge::GuiElementArray::onGuiVerify ( fge::Event const & evt,
SDL_EventType evtType,
fge::GuiElementContext & context )
inlineoverridevirtual

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.

Parameters
evtAn fge::Event
evtTypeThe type of the SDL event called
contextThe GuiElement context

Implements fge::GuiElement.

◆ setGuiScale()

void fge::GuiElement::setGuiScale ( fge::Vector2f const & scale)
inlineinherited

Set the scale of the element.

Parameters
scaleThe scale of the element

◆ setPriority()

void fge::GuiElement::setPriority ( fge::GuiElement::Priority priority) const
inlineinherited

Set the priority of the element.

The priority value can be used with the scene DepthPlan.

Parameters
priorityThe priority of the element

◆ verifyPriority()

bool fge::GuiElement::verifyPriority ( fge::GuiElement * element) const
inlinenodiscardinherited

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.

Parameters
elementThe element to compare with
Returns
true if the priority of the element is higher than the given element, false otherwise

Member Data Documentation

◆ _onGuiMouseButtonPressed

fge::CallbackHandler<fge::Event const&, SDL_MouseButtonEvent const&, fge::GuiElementContext&> fge::GuiElement::_onGuiMouseButtonPressed
inherited

Callback called when the element is verified and the mouse is pressed.

◆ _onGuiMouseButtonReleased

fge::CallbackHandler<fge::Event const&, SDL_MouseButtonEvent const&, fge::GuiElementContext&> fge::GuiElement::_onGuiMouseButtonReleased
inherited

Callback called when the element is verified and a mouse button is released.

◆ _onGuiMouseMoved

fge::CallbackHandler<fge::Event const&, SDL_MouseMotionEvent const&, fge::GuiElementContext&> fge::GuiElement::_onGuiMouseMoved
inherited

Callback called when the element is verified and the mouse is moved.

◆ _onGuiMouseWheelScrolled

fge::CallbackHandler<fge::Event const&, SDL_MouseWheelEvent const&, fge::GuiElementContext&> fge::GuiElement::_onGuiMouseWheelScrolled
inherited

Callback called when the element is verified and the mouse wheel is scrolled.


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