Gamedev Framework (gf)
0.8.0
A C++14 framework for 2D games
|
A choice sprite widget. More...
#include <gf/Widgets.h>
Public Member Functions | |
ChoiceSpriteWidget (Sprite &empty, Sprite &chosen) | |
Constructor. More... | |
void | setChosen (bool chosen=true) |
Set the state of the widget. More... | |
bool | isChosen () const noexcept |
Check if the widget is in the chosen state. More... | |
void | setEmptySprite (Sprite &sprite) |
Set the sprite for the empty state. More... | |
void | setChosenSprite (Sprite &sprite) |
Set the sprite for the chosen state. More... | |
Public Member Functions inherited from gf::SpriteWidget | |
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... | |
Protected Member Functions | |
virtual void | triggered () override |
Function called when the callback is triggered. More... | |
A choice sprite widget.
A choice widget may be used to represent a checkbox or a radio button.
Constructor.
empty | The sprite for representing the empty state |
chosen | The sprite for representing the chosen state |
|
inlinenoexcept |
Check if the widget is in the chosen state.
void gf::ChoiceSpriteWidget::setChosen | ( | bool | chosen = true | ) |
void gf::ChoiceSpriteWidget::setChosenSprite | ( | Sprite & | sprite | ) |
Set the sprite for the chosen state.
sprite | The sprite sued for the chosen state |
void gf::ChoiceSpriteWidget::setEmptySprite | ( | Sprite & | sprite | ) |
Set the sprite for the empty state.
sprite | The sprite used for the empty state |
|
overrideprotectedvirtual |
Function called when the callback is triggered.
This function is called before the callback.
Reimplemented from gf::Widget.