31 #ifndef _GG_DynamicGraphic_h_
32 #define _GG_DynamicGraphic_h_
95 DynamicGraphic(
X x,
Y y,
X w,
Y h,
bool loop,
X frame_width,
Y frame_height,
unsigned int margin,
96 const std::vector<boost::shared_ptr<Texture> >& textures,
102 std::size_t Frames()
const;
103 bool Playing()
const;
104 bool Looping()
const;
106 std::size_t FrameIndex()
const;
107 unsigned int TimeIndex()
const;
111 std::size_t StartFrame()
const;
115 std::size_t EndFrame()
const;
117 unsigned int Margin()
const;
118 X FrameWidth()
const;
119 Y FrameHeight()
const;
129 virtual void Render();
138 void AddFrames(
const Texture* texture, std::size_t frames = ALL_FRAMES);
145 void AddFrames(
const boost::shared_ptr<Texture>& texture, std::size_t frames = ALL_FRAMES);
154 void AddFrames(
const std::vector<boost::shared_ptr<Texture> >& textures, std::size_t frames = ALL_FRAMES);
161 void Loop(
bool b =
true);
166 void SetFPS(
double fps);
168 void SetFrameIndex(std::size_t idx);
176 void SetTimeIndex(
unsigned int time);
181 void SetStartFrame(std::size_t idx);
186 void SetEndFrame(std::size_t idx);
202 static const std::size_t ALL_FRAMES;
203 static const std::size_t INVALID_INDEX;
204 static const unsigned int INVALID_TIME;
209 boost::shared_ptr<const Texture> texture;
218 std::size_t FramesInTexture(
const Texture* t)
const;
219 const std::vector<FrameSet>& Textures()
const;
221 std::size_t CurrentTexture()
const;
222 std::size_t CurrentSubTexture()
const;
223 unsigned int FirstFrameTime()
const;
224 unsigned int LastFrameTime()
const;
232 void ValidateStyle();
234 std::vector<FrameSet> m_textures;
239 std::size_t m_curr_texture;
240 std::size_t m_curr_subtexture;
241 std::size_t m_frames;
242 std::size_t m_curr_frame;
243 unsigned int m_first_frame_time;
244 unsigned int m_last_frame_time;
245 std::size_t m_first_frame_idx;
246 std::size_t m_last_frame_idx;