TGUI  v0.5.2
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Public Member Functions | List of all members
tgui::AnimatedPicture Struct Reference

Load multiple images and add then behind each other to create a simple animation or even a movie. More...

#include <AnimatedPicture.hpp>

Inheritance diagram for tgui::AnimatedPicture:
tgui::OBJECT tgui::OBJECT_ANIMATION

Public Member Functions

 AnimatedPicture ()
 Default constructor. More...
 
 AnimatedPicture (const AnimatedPicture &copy)
 Copy constructor. More...
 
virtual ~AnimatedPicture ()
 Destructor. More...
 
AnimatedPictureoperator= (const AnimatedPicture &right)
 Overload of assignment operator. More...
 
virtual unsigned int addFrame (const std::string &filename, sf::Time frameDurarion=sf::Time())
 Load another image/frame from a file. More...
 
virtual void setSize (float width, float height)
 Changes the size of the displayed image. More...
 
virtual Vector2u getSize () const
 Returns the size of the first frame, unaffected by scaling. More...
 
virtual Vector2f getScaledSize () const
 Returns the size of the first frame, after the scaling tranformations. More...
 
virtual void play ()
 Starts or resumes playing the animation. More...
 
virtual void pause ()
 Pauses the animation. More...
 
virtual void stop ()
 Stops the animation. More...
 
virtual void setFrame (unsigned int frame)
 Sets the animation at a specific frame. More...
 
virtual unsigned int getCurrentFrame () const
 Returns the current displayed frame. More...
 
virtual void setFrameDuration (unsigned int frame, sf::Time frameDuration=sf::Time())
 Changes the amount of time that the frame will be displayed on the screen. More...
 
virtual sf::Time getCurrentFrameDuration () const
 Returns the duration of the currently displayed frame. More...
 
virtual unsigned int getFrames () const
 Returns the amount of frames in the animation. More...
 
virtual std::vector< std::string > getLoadedFilenames () const
 Returns the filenames that were used to load the pictures. More...
 
virtual void removeFrame (unsigned int frame)
 Removes a frame from the animation. More...
 
virtual void removeAllFrames ()
 Remove all frames from the animation. More...
 
- Public Member Functions inherited from tgui::OBJECT
 OBJECT ()
 Default constructor. More...
 
 OBJECT (const OBJECT &copy)
 Copy constructor. More...
 
virtual ~OBJECT ()
 Destructor. More...
 
OBJECToperator= (const OBJECT &right)
 Overload of assignment operator. More...
 
virtual void show ()
 Shows the object. More...
 
virtual void hide ()
 Hides the object. More...
 
virtual bool isVisible () const
 Returns true when the object is visible. More...
 
virtual void enable ()
 Enables the object. More...
 
virtual void disable ()
 Disables the object. More...
 
virtual bool isEnabled () const
 Returns true when the object is enabled. More...
 
virtual bool isDisabled () const
 Returns true when the object is disabled. More...
 
virtual bool isLoaded () const
 Returns true when the object is loaded successfully. More...
 
void focus ()
 Focus the object. More...
 
void unfocus ()
 Unfocus the object. More...
 
void focusNextObject ()
 Focuses the next object. More...
 
virtual bool isFocused () const
 Returns true when the object is focused and false otherwise. More...
 
virtual ObjectTypes getObjectType () const
 Returns the type of the object. More...
 
virtual void moveToFront ()
 Places the object before all other objects. More...
 
virtual void moveToBack ()
 Places the object behind all other objects. More...
 

Detailed Description

Load multiple images and add then behind each other to create a simple animation or even a movie.

Constructor & Destructor Documentation

tgui::AnimatedPicture::AnimatedPicture ( )

Default constructor.

tgui::AnimatedPicture::AnimatedPicture ( const AnimatedPicture copy)

Copy constructor.

virtual tgui::AnimatedPicture::~AnimatedPicture ( )
virtual

Destructor.

Member Function Documentation

virtual unsigned int tgui::AnimatedPicture::addFrame ( const std::string &  filename,
sf::Time  frameDurarion = sf::Time() 
)
virtual

Load another image/frame from a file.

All frames should have the same size. The size of the first frame is always used in the calculations.

Parameters
filenameThe filename of the image that you want to use as next frame.
frameDurationThe amount of time that the frame will be displayed on the screen. When the duration is 0 (default) then the animation will be blocked at that frame.
Returns
  • 0 when the filename is empty
  • 0 when the image couldn't be loaded (probalby not found)
  • The frame number on success (the first frame has number 1)
virtual unsigned int tgui::AnimatedPicture::getCurrentFrame ( ) const
virtual

Returns the current displayed frame.

This function will return 0 when no frames have been loaded.

virtual sf::Time tgui::AnimatedPicture::getCurrentFrameDuration ( ) const
virtual

Returns the duration of the currently displayed frame.

This function will return 0 when no frames have been loaded.

virtual unsigned int tgui::AnimatedPicture::getFrames ( ) const
virtual

Returns the amount of frames in the animation.

virtual std::vector<std::string> tgui::AnimatedPicture::getLoadedFilenames ( ) const
virtual

Returns the filenames that were used to load the pictures.

When no picture has been loaded yet then this function will return an empty vector.

virtual Vector2f tgui::AnimatedPicture::getScaledSize ( ) const
virtual

Returns the size of the first frame, after the scaling tranformations.

Implements tgui::OBJECT.

virtual Vector2u tgui::AnimatedPicture::getSize ( ) const
virtual

Returns the size of the first frame, unaffected by scaling.

Implements tgui::OBJECT.

AnimatedPicture& tgui::AnimatedPicture::operator= ( const AnimatedPicture right)

Overload of assignment operator.

virtual void tgui::AnimatedPicture::pause ( )
virtual

Pauses the animation.

You can continue the animation with the start() function.

See Also
play
stop
virtual void tgui::AnimatedPicture::play ( )
virtual

Starts or resumes playing the animation.

See Also
pause
stop
virtual void tgui::AnimatedPicture::removeAllFrames ( )
virtual

Remove all frames from the animation.

See Also
removeFrame
virtual void tgui::AnimatedPicture::removeFrame ( unsigned int  frame)
virtual

Removes a frame from the animation.

Both 0 and 1 will remove the first frame. When frame is bigger than the amount of frames then the last frame will be removed.

See Also
removeAllFrames
virtual void tgui::AnimatedPicture::setFrame ( unsigned int  frame)
virtual

Sets the animation at a specific frame.

When there are less frames than frame, the last frame will be displayed. Both 0 and 1 will set the first frame.

virtual void tgui::AnimatedPicture::setFrameDuration ( unsigned int  frame,
sf::Time  frameDuration = sf::Time() 
)
virtual

Changes the amount of time that the frame will be displayed on the screen.

Parameters
frameThe frame that is going to have the given duration. Both 0 and 1 will affect the first frame. When frame is bigger than the amount of frames then the last frame will be changed.
frameDurationThe amount of time that the frame will be displayed on the screen. When the duration is 0 (default) then the animation will be blocked at that frame.
virtual void tgui::AnimatedPicture::setSize ( float  width,
float  height 
)
virtual

Changes the size of the displayed image.

All frames should have the same size. The scaling factors used to get the first frame to the correct size, will also be used for the other frames.

This function can only be called after the first frame is loaded.

Implements tgui::OBJECT.

virtual void tgui::AnimatedPicture::stop ( )
virtual

Stops the animation.

When calling start() after calling this function, the animation will restart from the first frame.

See Also
play
pause

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