![]() |
Gamedev Framework (gf)
0.8.0
A C++14 framework for 2D games
|
The widgets abstract class. More...
#include <gf/Widget.h>

Public Member Functions | |
| Widget () | |
| Constructor. More... | |
| virtual | ~Widget () |
| Destructor. More... | |
| virtual void | render (RenderTarget &target, const RenderStates &states)=0 |
| Render the widget on the target. More... | |
| virtual bool | contains (Vector2f coords)=0 |
| Check if the widget contains the coordinates. More... | |
| void | setDisabled () |
| Disable the widget. More... | |
| bool | isDisabled () const noexcept |
| Check if the widget is disabled. More... | |
| void | setDefault () |
| Set the widget to it's default state. More... | |
| bool | isDefault () const noexcept |
| Check if the widget is in default state. More... | |
| void | setSelected () |
| Select the widget. More... | |
| bool | isSelected () const |
| Check if the widget is selected. More... | |
| void | setState (WidgetState state) |
| Set the state of the widget directly. More... | |
| WidgetState | getState () const noexcept |
| Get the state of the widget. More... | |
| void | setCallback (std::function< void()> callback) |
| Set the callback of the widget. More... | |
| void | triggerCallback () |
| Execute the callback function. More... | |
Protected Member Functions | |
| virtual void | triggered () |
| Function called when the callback is triggered. More... | |
The widgets abstract class.
| gf::Widget::Widget | ( | ) |
Constructor.
The widget is in the default state.
|
virtual |
Destructor.
|
pure virtual |
Check if the widget contains the coordinates.
| coords | The coordinates to check |
Implemented in gf::SpriteWidget, gf::TextShapeWidget, and gf::TextWidget.
|
inlinenoexcept |
Get the state of the widget.
|
inlinenoexcept |
Check if the widget is in default state.
|
inlinenoexcept |
Check if the widget is disabled.
|
inline |
Check if the widget is selected.
|
pure virtual |
Render the widget on the target.
| target | The render target |
| states | The render states to use for drawing |
Implemented in gf::SpriteWidget, gf::TextShapeWidget, and gf::TextWidget.
| void gf::Widget::setCallback | ( | std::function< void()> | callback | ) |
Set the callback of the widget.
| callback | The function that will be execute when the widget will be triggered. |
| void gf::Widget::setDefault | ( | ) |
Set the widget to it's default state.
| void gf::Widget::setDisabled | ( | ) |
Disable the widget.
| void gf::Widget::setSelected | ( | ) |
Select the widget.
| void gf::Widget::setState | ( | WidgetState | state | ) |
Set the state of the widget directly.
| state | The new state |
| void gf::Widget::triggerCallback | ( | ) |
Execute the callback function.
|
protectedvirtual |
Function called when the callback is triggered.
This function is called before the callback.
Reimplemented in gf::ChoiceSpriteWidget.
1.8.13