![]()  | 
  
    Gamedev Framework (gf)
    0.14.0
    
   A C++14 framework for 2D games 
   | 
 
A choice sprite widget. More...
#include <gf/Widgets.h>
Public Member Functions | |
| ChoiceSpriteWidget (const Texture &texture, const RectF &emptyRect, const RectF &chosenRect) | |
| Constructor.  More... | |
| ChoiceSpriteWidget (const Texture &emptyTexture, const Texture &chosenTexture) | |
| Constructor.  More... | |
| void | draw (RenderTarget &target, const RenderStates &states) override | 
| Draw the object to a render target.  More... | |
| bool | contains (Vector2f coords) override | 
| Check if the widget contains the coordinates.  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 (const Texture &texture, const RectF &textureRect) | 
| Set the sprite for the empty state.  More... | |
| void | setChosenSprite (const Texture &texture, const RectF &textureRect) | 
| Set the sprite for the chosen state.  More... | |
  Public Member Functions inherited from gf::Widget | |
| Widget () | |
| Constructor.  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... | |
  Public Member Functions inherited from gf::Transformable | |
| Transformable () | |
| Default constructor.  More... | |
| void | setOrigin (Vector2f origin) | 
| Set the local origin of the object.  More... | |
| Vector2f | getOrigin () const | 
| Get the local origin of the object.  More... | |
| void | setPosition (Vector2f position) | 
| Set the position of the object.  More... | |
| Vector2f | getPosition () const | 
| Get the position of the object.  More... | |
| void | move (Vector2f offset) | 
| Move the object by a given offset.  More... | |
| void | setRotation (float angle) | 
| Set the orientation of the object.  More... | |
| float | getRotation () const | 
| Get the orientation of the object.  More... | |
| void | rotate (float angle) | 
| Rotate the object.  More... | |
| void | setScale (Vector2f factors) | 
| Set the scale factors of the object.  More... | |
| void | setScale (float factor) | 
| Set the scale factor of the object.  More... | |
| Vector2f | getScale () const | 
| Get the current scale of the object.  More... | |
| void | scale (Vector2f factors) | 
| Scale the object.  More... | |
| void | scale (float factor) | 
| Scale the object.  More... | |
| Matrix3f | getTransform () const | 
| Get the combined transform of the object.  More... | |
| Matrix3f | getInverseTransform () const | 
| Get the inverse of the combined transform of the object.  More... | |
  Public Member Functions inherited from gf::Drawable | |
| virtual | ~Drawable () | 
| Virtual desctructor.  More... | |
Protected Member Functions | |
| void | triggered () override | 
| Function called when the callback is triggered.  More... | |
  Protected Member Functions inherited from gf::Widget | |
| virtual void | onStateChanged () | 
| Function called when the state changes.  More... | |
  Protected Member Functions inherited from gf::Transformable | |
| void | setOriginFromAnchorAndBounds (Anchor anchor, const RectF &bounds) | 
| Set the origin from an anchor and bounds.  More... | |
A choice sprite widget.
A choice widget may be used to represent a checkbox or a radio button.
| gf::ChoiceSpriteWidget::ChoiceSpriteWidget | ( | const Texture & | texture, | 
| const RectF & | emptyRect, | ||
| const RectF & | chosenRect | ||
| ) | 
Constructor.
| texture | The texture used for the widget | 
| emptyRect | The rectangle in the texture for the empty state | 
| chosenRect | The rectangle in the texture for the chosen state | 
| gf::ChoiceSpriteWidget::ChoiceSpriteWidget | ( | const Texture & | emptyTexture, | 
| const Texture & | chosenTexture | ||
| ) | 
Constructor.
| emptyTexture | The texture for the empty state | 
| chosenTexture | The texture for the chosen state | 
      
  | 
  overridevirtual | 
Check if the widget contains the coordinates.
| coords | The coordinates to check | 
Implements gf::Widget.
      
  | 
  overridevirtual | 
Draw the object to a render target.
This is a pure virtual function that has to be implemented by the derived class to define how the drawable should be drawn.
| target | Render target to draw to | 
| states | Current render states | 
Implements gf::Drawable.
      
  | 
  inlinenoexcept | 
Check if the widget is in the chosen state.
| void gf::ChoiceSpriteWidget::setChosen | ( | bool | chosen = true | ) | 
Set the sprite for the chosen state.
| texture | The texture used for the chosen state | 
| textureRect | The rectangle in the texture used for the chosen state | 
Set the sprite for the empty state.
| texture | The texture used for the empty state | 
| textureRect | The rectangle in the texture used for the empty state | 
      
  | 
  overrideprotectedvirtual | 
Function called when the callback is triggered.
This function is called before the callback.
Reimplemented from gf::Widget.
 1.8.13