FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
animationicon.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2013 by the FIFE team *
3  * http://www.fifengine.net *
4  * This file is part of FIFE. *
5  * *
6  * FIFE is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU Lesser General Public *
8  * License as published by the Free Software Foundation; either *
9  * version 2.1 of the License, or (at your option) any later version. *
10  * *
11  * This library is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with this library; if not, write to the *
18  * Free Software Foundation, Inc., *
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20  ***************************************************************************/
21 
22 #ifndef FIFE_GUI_WIDGETS_ANIMATIONICON_H
23 #define FIFE_GUI_WIDGETS_ANIMATIONICON_H
24 
25 // Standard C++ library includes
26 
27 // 3rd party library includes
28 #include <fifechan/image.hpp>
29 #include <fifechan/platform.hpp>
30 #include <fifechan.hpp>
31 
32 // FIFE includes
33 // These includes are split up in two parts, separated by one empty line
34 // First block: files included from the FIFE root src directory
35 // Second block: files included from the same folder
36 #include "util/base/fife_stdint.h"
37 #include "video/animation.h"
38 
39 namespace FIFE {
40  class TimeManager;
41 }
42 
43 namespace fcn {
44 
48  class AnimationIcon : public Icon {
49  public:
53  AnimationIcon();
54 
61 
65  virtual ~AnimationIcon();
66 
72  void setAnimation(FIFE::AnimationPtr animation);
73 
80 
86  void setRepeating(bool repeat);
87 
93  bool isRepeating() const;
94 
98  void play();
99 
105  bool isPlaying() const;
106 
110  void pause();
111 
115  void stop();
116 
117 
118  // Inherited from Widget
119 
120  virtual void logic();
121 
122  protected:
127 
132 
137  const Image* mCurrentImage;
138 
143 
147  int32_t mFrameIndex;
148 
152  bool mRepeat;
153 
157  bool mPlay;
158 
159  };
160 }
161 
162 #endif
virtual ~AnimationIcon()
Destructor.
bool isRepeating() const
Gets repeating of the animation.
void setAnimation(FIFE::AnimationPtr animation)
Sets the animation to display.
void pause()
Stops the animation at the current frame.
const Image * mCurrentImage
Currently used image.
bool mPlay
True if the animation was started, otherwise false.
bool isPlaying() const
Gets if the animation is playing.
virtual void logic()
void setRepeating(bool repeat)
Sets repeating of the animation.
FIFE::AnimationPtr getAnimation() const
Gets the current animation.
FIFE::AnimationPtr mAnimation
The animation to display.
FIFE::TimeManager * mTimemanager
Holds pointer to Fifes TimeManager.
Implements an icon capable of displaying an animation.
Definition: animationicon.h:48
Time Manager.
Definition: timemanager.h:50
void stop()
Stops the animation and sets the current frame to the first frame.
void play()
Starts the animation from beginning.
int32_t mFrameIndex
The last used frame index from the animation.
AnimationIcon()
Default constructor.
bool mRepeat
True if the animation should be repeating, otherwise false.
unsigned int uint32_t
Definition: core.h:40
uint32_t mAnimtime
The time as the animation was started.