104 vector <image *>::iterator i;
105 for (i = t_frame.begin (); i != t_frame.end (); i++)
180 for (i = 0; i < nbr_images; i++)
182 t_frame.push_back (
new image);
183 t_frame.back ()->get_raw (file);
190 for (i = 0; i < nbr_frames; i++)
192 frame.push_back (aftemp);
193 frame.back ().get (file);
200 calculate_dimensions ();
212 retvalue =
get (file);
235 t_frame[i]->put_raw (file);
256 retvalue =
put (file);
263 vector <image *>::iterator i;
264 vector <animationframe>::iterator j;
269 i = t_frame.begin ();
273 t_frame.insert (i, (
image *) im);
275 for (j = frame.begin (); j != frame.end (); j++)
276 if (j->image_nbr () >= pos)
277 j->set_image_nbr (j->image_nbr () + 1);
284 vector <image *>::iterator i;
285 vector <animationframe>::iterator j;
290 i = t_frame.begin ();
297 for (j = frame.begin (); j != frame.end (); j++)
298 if (j->image_nbr () >= pos)
299 j->set_image_nbr (j->image_nbr () - 1);
306 vector <animationframe>::iterator i;
315 frame.insert (i, af);
317 for (i = frame.begin (); i != frame.end (); i++)
318 if (i->nextframe () >= pos)
319 i->set_nextframe (i->nextframe () + 1);
326 vector <animationframe>::iterator i;
331 for (i = frame.begin (); i != frame.end (); i++)
332 if (i->nextframe () >= pos)
333 i->set_nextframe (frame[i->nextframe ()].nextframe ());
356 im->
resize ((src->t_frame[i]->length () * sx) / src->
length (),
357 (src->t_frame[i]->height () * sy) / src->
height ());
358 im->
zoom ((*src->t_frame[i]));
359 t_frame.push_back (im);
364 frame.push_back (src->frame[i]);
365 frame.back ().set_offset ((src->frame[i].offx () * sx) / src->
length (),
366 (src->frame[i].offy () * sy) / src->
height ());
376 vector <image *>::iterator imit;
377 for (imit = src.t_frame.begin (); imit != src.t_frame.end (); imit++)
381 t_frame.push_back (im);
385 vector <animationframe>::iterator frit;
386 for (frit = src.frame.begin (); frit != src.frame.end (); frit++)
388 frame.push_back (*frit);
392 currentframe_ = src.currentframe_;
393 speedcounter = src.speedcounter;
394 play_flag = src.play_flag;
407 void animation::calculate_dimensions ()
414 t_frame[frame[i].image_nbr ()]->
length () + frame[i].offx ()) >
419 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.