![]() |
Gamedev Framework (gf)
0.8.0
A C++14 framework for 2D games
|
A widget with a set of sprites. More...
#include <gf/Widgets.h>
Public Member Functions | |
| SpriteWidget (Sprite &sprite) | |
| Constructor with a single sprite. More... | |
| SpriteWidget (Sprite &defaultSprite, Sprite &selectedSprite) | |
| Constructor with two sprites. More... | |
| SpriteWidget (Sprite &defaultSprite, Sprite &selectedSprite, Sprite &disabledSprite) | |
| Constructor with three sprites. More... | |
| void | setDisabledSprite (Sprite &sprite) |
| Set the sprite for disabled state. More... | |
| void | setDefaultSprite (Sprite &sprite) |
| Set the sprite for default state. More... | |
| void | setSelectedSprite (Sprite &sprite) |
| Set the sprite for selected state. More... | |
| virtual void | render (RenderTarget &target, const RenderStates &states) override |
| Render the widget on the target. More... | |
| virtual bool | contains (Vector2f coords) override |
| Check if the widget contains the coordinates. More... | |
Public Member Functions inherited from gf::Widget | |
| Widget () | |
| Constructor. More... | |
| virtual | ~Widget () |
| Destructor. 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... | |
Additional Inherited Members | |
Protected Member Functions inherited from gf::Widget | |
| virtual void | triggered () |
| Function called when the callback is triggered. More... | |
A widget with a set of sprites.
| gf::SpriteWidget::SpriteWidget | ( | Sprite & | sprite | ) |
Constructor with a single sprite.
| sprite | The sprite used for disabled, default and selected state |
Constructor with two sprites.
| defaultSprite | The sprite used for disabled and default state |
| selectedSprite | The sprite used for selected state |
| gf::SpriteWidget::SpriteWidget | ( | Sprite & | defaultSprite, |
| Sprite & | selectedSprite, | ||
| Sprite & | disabledSprite | ||
| ) |
Constructor with three sprites.
| defaultSprite | The sprite used for default state |
| selectedSprite | The sprite used for selected state |
| disabledSprite | The sprite used for disabled state |
|
overridevirtual |
Check if the widget contains the coordinates.
| coords | The coordinates to check |
Implements gf::Widget.
|
overridevirtual |
Render the widget on the target.
| target | The render target |
| states | The render states to use for drawing |
Implements gf::Widget.
| void gf::SpriteWidget::setDefaultSprite | ( | Sprite & | sprite | ) |
Set the sprite for default state.
| sprite | The sprite used for default state |
| void gf::SpriteWidget::setDisabledSprite | ( | Sprite & | sprite | ) |
Set the sprite for disabled state.
| sprite | The sprite used for disabled state |
| void gf::SpriteWidget::setSelectedSprite | ( | Sprite & | sprite | ) |
Set the sprite for selected state.
| sprite | The sprite used for selected state |
1.8.13