TGUI  v0.6.10
Public Types | Public Member Functions | List of all members
tgui::SpriteSheet Class Reference

Load one big image and split it into smaller images so that you can display tiles or play an animation. More...

#include <SpriteSheet.hpp>

Inheritance diagram for tgui::SpriteSheet:
tgui::Picture tgui::ClickableWidget tgui::Widget tgui::Transformable tgui::CallbackManager

Public Types

- Public Types inherited from tgui::Picture
- Public Types inherited from tgui::ClickableWidget
- Public Types inherited from tgui::Widget

Public Member Functions

 SpriteSheet ()
 Default constructor. More...
 
 SpriteSheet (const SpriteSheet &copy)
 Copy constructor. More...
 
SpriteSheetoperator= (const SpriteSheet &right)
 Overload of assignment operator. More...
 
void setSize (float width, float height)
 Changes the size of the picture cell, so the piece that is shown. More...
 
virtual sf::Vector2f getSize () const
 Returns the size of a picture cell, so the piece that is shown. More...
 
void setCells (unsigned int rows, unsigned int columns)
 Change the number of rows and columns in the image. More...
 
void setRows (unsigned int rows)
 Change the number of rows in the image. More...
 
unsigned int getRows () const
 Returns the number of rows in the image. More...
 
void setColumns (unsigned int columns)
 Change the number of columns in the image. More...
 
unsigned int getColumns () const
 Returns the number of columns in the image. More...
 
void setVisibleCell (unsigned int row, unsigned int column)
 Choose which cell should be displayed. More...
 
sf::Vector2u getVisibleCell () const
 Returns which cell is being displayed. More...
 
- Public Member Functions inherited from tgui::Picture
 Picture ()
 Default constructor. More...
 
 Picture (const Picture &copy)
 Copy constructor. More...
 
virtual ~Picture ()
 Destructor. More...
 
Pictureoperator= (const Picture &right)
 Overload of assignment operator. More...
 
bool load (const std::string &filename)
 Load an image from a file. More...
 
void loadFromTexture (const sf::Texture &texture)
 Load from an existing sf::Texture. More...
 
const std::string & getLoadedFilename () const
 Returns the filename of the image that was used to load the widget. More...
 
virtual void setPosition (float x, float y)
 Set the position of the widget. More...
 
void setSmooth (bool smooth)
 Enable or disable the smooth filter. More...
 
bool isSmooth () const
 Tell whether the smooth filter is enabled or not. More...
 
virtual void setTransparency (unsigned char transparency)
 Changes the transparency of the widget. More...
 
- Public Member Functions inherited from tgui::ClickableWidget
 ClickableWidget ()
 Default constructor. More...
 
 ClickableWidget (const ClickableWidget &copy)
 Copy constructor. More...
 
virtual ~ClickableWidget ()
 Destructor. More...
 
ClickableWidgetoperator= (const ClickableWidget &right)
 Overload of assignment operator. More...
 
- Public Member Functions inherited from tgui::Widget
 Widget ()
 Default constructor. More...
 
 Widget (const Widget &copy)
 Copy constructor. More...
 
virtual ~Widget ()
 Destructor. More...
 
Widgetoperator= (const Widget &right)
 Overload of assignment operator. More...
 
virtual sf::Vector2f getAbsolutePosition () const
 Get the absolute position of the widget on the screen. More...
 
virtual void show ()
 Shows the widget. More...
 
virtual void hide ()
 Hides the widget. More...
 
bool isVisible () const
 Returns true when the widget is visible. More...
 
virtual void enable ()
 Enables the widget. More...
 
virtual void disable ()
 Disables the widget. More...
 
bool isEnabled () const
 Returns true when the widget is enabled. More...
 
bool isDisabled () const
 Returns true when the widget is disabled. More...
 
bool isLoaded () const
 Returns true when the widget is loaded successfully. More...
 
virtual void focus ()
 Focus the widget. More...
 
virtual void unfocus ()
 Unfocus the widget. More...
 
bool isFocused () const
 Returns true when the widget is focused and false otherwise. More...
 
WidgetTypes getWidgetType () const
 Returns the type of the widget. More...
 
ContainergetParent () const
 Returns a pointer to the parent widget. More...
 
unsigned char getTransparency () const
 Returns the transparency of the widget. More...
 
virtual void moveToFront ()
 Places the widget before all other widgets. More...
 
virtual void moveToBack ()
 Places the widget behind all other widgets. More...
 
void setCallbackId (unsigned int callbackId)
 Changes the callback id of the widget. More...
 
unsigned int getCallbackId ()
 Returns the callback id of the widget. More...
 
- Public Member Functions inherited from tgui::Transformable
 Transformable ()
 Default constructor. More...
 
virtual ~Transformable ()
 Destructor. More...
 
void setPosition (const sf::Vector2f &position)
 set the position of the widget More...
 
const sf::Vector2f & getPosition () const
 get the position of the widget More...
 
void move (float offsetX, float offsetY)
 Move the widget by a given offset. More...
 
void move (const sf::Vector2f &offset)
 Move the widget by a given offset. More...
 
virtual sf::Vector2f getFullSize () const
 Returns the entire size that the widget is using. More...
 
void scale (float factorX, float factorY)
 Scale the widget. More...
 
void scale (const sf::Vector2f &factors)
 Scale the widget. More...
 
- Public Member Functions inherited from tgui::CallbackManager
void bindCallback (std::function< void()> func, unsigned int trigger)
 Bind a function to one or more specific callback trigger(s). More...
 
template<typename T >
void bindCallback (void(T::*func)(), T *const classPtr, unsigned int trigger)
 Bind a function to one or more specific callback trigger(s). More...
 
void bindCallbackEx (std::function< void(const Callback &)> func, unsigned int trigger)
 Bind a function to one or more specific callback trigger(s). More...
 
template<typename T >
void bindCallbackEx (void(T::*func)(const Callback &), T *const classPtr, unsigned int trigger)
 Bind a function to one or more specific callback trigger(s). More...
 
void bindCallback (unsigned int trigger)
 Bind one or more specific callback trigger(s) to the parent widget. More...
 
void unbindCallback (unsigned int trigger)
 Unbind all callback function bound to the given trigger. More...
 
void unbindAllCallback ()
 Unbind all callback functions bound to any callback. More...
 

Detailed Description

Load one big image and split it into smaller images so that you can display tiles or play an animation.

Member Enumeration Documentation

Defines specific triggers to SpriteSheet.

Enumerator
AllSpriteSheetCallbacks 

All triggers defined in SpriteSheet and its base classes.

Constructor & Destructor Documentation

tgui::SpriteSheet::SpriteSheet ( )

Default constructor.

tgui::SpriteSheet::SpriteSheet ( const SpriteSheet copy)

Copy constructor.

Parameters
copyInstance to copy

Member Function Documentation

unsigned int tgui::SpriteSheet::getColumns ( ) const

Returns the number of columns in the image.

Returns
The amount of columns in the picture
unsigned int tgui::SpriteSheet::getRows ( ) const

Returns the number of rows in the image.

Returns
The amount of rows in the picture
virtual sf::Vector2f tgui::SpriteSheet::getSize ( ) const
virtual

Returns the size of a picture cell, so the piece that is shown.

Returns
Size of the cell

Reimplemented from tgui::ClickableWidget.

sf::Vector2u tgui::SpriteSheet::getVisibleCell ( ) const

Returns which cell is being displayed.

Returns
A vector containing the row and column in which the visible cell is located
SpriteSheet& tgui::SpriteSheet::operator= ( const SpriteSheet right)

Overload of assignment operator.

Parameters
rightInstance to assign
Returns
Reference to itself
void tgui::SpriteSheet::setCells ( unsigned int  rows,
unsigned int  columns 
)

Change the number of rows and columns in the image.

Parameters
rowsThe amount of rows in the picture
columnsThe amount of columns in the picture
void tgui::SpriteSheet::setColumns ( unsigned int  columns)

Change the number of columns in the image.

Parameters
columnsThe amount of columns in the picture
void tgui::SpriteSheet::setRows ( unsigned int  rows)

Change the number of rows in the image.

Parameters
rowsThe amount of rows in the picture
void tgui::SpriteSheet::setSize ( float  width,
float  height 
)
virtual

Changes the size of the picture cell, so the piece that is shown.

Parameters
widthThe new width of the picture cell.
heightThe new height of the picture cell.

Reimplemented from tgui::Picture.

void tgui::SpriteSheet::setVisibleCell ( unsigned int  row,
unsigned int  column 
)

Choose which cell should be displayed.

Parameters
rowThe row in which the visible cell is located
columnThe column in which the visible cell is located

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