107 vector <image *>::iterator i;
108 for (i = t_frame.begin (); i != t_frame.end (); i++)
183 for (i = 0; i < nbr_images; i++)
185 t_frame.push_back (
new image);
186 t_frame.back ()->get_raw (file);
193 for (i = 0; i < nbr_frames; i++)
195 frame.push_back (aftemp);
196 frame.back ().get (file);
203 calculate_dimensions ();
215 retvalue =
get (file);
238 t_frame[i]->put_raw (file);
259 retvalue =
put (file);
266 vector <image *>::iterator i;
267 vector <animationframe>::iterator j;
272 i = t_frame.begin ();
276 t_frame.insert (i, (
image *) im);
278 for (j = frame.begin (); j != frame.end (); j++)
279 if (j->image_nbr () >= pos)
280 j->set_image_nbr (j->image_nbr () + 1);
287 vector <image *>::iterator i;
288 vector <animationframe>::iterator j;
293 i = t_frame.begin ();
300 for (j = frame.begin (); j != frame.end (); j++)
301 if (j->image_nbr () >= pos)
302 j->set_image_nbr (j->image_nbr () - 1);
309 vector <animationframe>::iterator i;
318 frame.insert (i, af);
320 for (i = frame.begin (); i != frame.end (); i++)
321 if (i->nextframe () >= pos)
322 i->set_nextframe (i->nextframe () + 1);
329 vector <animationframe>::iterator i;
334 for (i = frame.begin (); i != frame.end (); i++)
335 if (i->nextframe () >= pos)
336 i->set_nextframe (frame[i->nextframe ()].nextframe ());
359 im->
resize ((src->t_frame[i]->length () * sx) / src->
length (),
360 (src->t_frame[i]->height () * sy) / src->
height ());
361 im->
zoom ((*src->t_frame[i]));
362 t_frame.push_back (im);
367 frame.push_back (src->frame[i]);
368 frame.back ().set_offset ((src->frame[i].offx () * sx) / src->
length (),
369 (src->frame[i].offy () * sy) / src->
height ());
379 vector <image *>::iterator imit;
380 for (imit = src.t_frame.begin (); imit != src.t_frame.end (); imit++)
384 t_frame.push_back (im);
388 vector <animationframe>::iterator frit;
389 for (frit = src.frame.begin (); frit != src.frame.end (); frit++)
391 frame.push_back (*frit);
395 currentframe_ = src.currentframe_;
396 speedcounter = src.speedcounter;
397 play_flag = src.play_flag;
410 void animation::calculate_dimensions ()
417 t_frame[frame[i].image_nbr ()]->
length () + frame[i].offx ()) >
422 t_frame[frame[i].image_nbr ()]->
height () + frame[i].offy ()) >
Class to write data from a Gzip compressed file.
void close()
Close the file that was opened.
void set_length(u_int16 l)
Sets the length of the drawable.
u_int16 length() const
Returns the length of the drawable.
Class to read data from a Gzip compressed file.
Declares the animationframe and animation classes.
void resize(u_int16 l, u_int16 h)
Resize this image.
#define u_int16
16 bits long unsigned integer
void set_height(u_int16 h)
Sets the height of the drawable.
~animationframe()
Destructor.
Class where drawables can actually be drawn to.
s_int8 insert_image(const image *im, u_int16 pos)
Inserts an image at a given position of the image array.
void clear()
Clears an animation, that is put it back into the original (constructor) state.
void clear()
Resets an animationframe to it's initial (i.e post-constructor) state.
Image manipulation class.
#define u_int8
8 bits long unsigned integer
s_int8 put(ogzstream &file) const
Saves an animationframe into an opened file.
s_int8 delete_frame(u_int16 pos)
Removes a frame at a given position.
bool is_open()
Returns whether the file is opened or not.
u_int16 currentframe() const
Returns the index of the currently displayed frame.
Implements "drawing zones" for drawing operations.
s_int16 yoffset() const
Returns the global Y offset of the animation.
s_int8 delete_image(u_int16 pos)
Removes an image at a given position.
animation & operator=(const animation &src)
Animation copy (similar to copy ()).
Handles images properties in an animation.
void draw(s_int16 x, s_int16 y, const drawing_area *da_opt=NULL, surface *target=NULL) const
Draw the object on the screen.
u_int16 height() const
Returns the height of the drawable.
#define s_int16
16 bits long signed integer
animation()
Default constructor.
void zoom(const surface &src)
Zooms a surface.
s_int8 put(ogzstream &file) const
Saves an animation into an opened file, in game format, with alpha and mask values.
void next_frame()
Directly jumps to the next frame.
s_int16 xoffset() const
Returns the global X offset of the animation.
u_int16 nbr_of_frames() const
Returns the number of frames in this animation.
s_int8 save(string fname) const
Saves an animation into an file, in game format, with alpha and mask values.
animationframe()
Default constructor.
Abstract class for drawable objects manipulation.
s_int8 get(igzstream &file)
Loads an animation from an opened file.
bool update()
Updates the animation state.
Class that handles animated elements, their update and their playback.
u_int16 nbr_of_images() const
Returns the number of images in this animation.
s_int8 load(string fname)
Loads an animation from it's filename.
void set_offset(s_int16 x, s_int16 y)
Set the global offsets of this animation.
#define s_int8
8 bits long signed integer
void zoom(u_int16 sx, u_int16 sy, const animation *src)
Zooms an animation.
s_int8 insert_frame(const animationframe af, u_int16 pos)
Inserts a frame at a given position of the animationframe array.
s_int8 get(igzstream &file)
Loads an animationframe from an opened file.