Go to the documentation of this file.
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 ()) >
s_int8 put(ogzstream &file) const
Saves an animation into an opened file, in game format, with alpha and mask values.
void clear()
Resets an animationframe to it's initial (i.e post-constructor) state.
s_int8 delete_frame(u_int16 pos)
Removes a frame at a given position.
Handles images properties in an animation.
Declares the animationframe and animation classes.
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.
void zoom(u_int16 sx, u_int16 sy, const animation *src)
Zooms 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.
Class where drawables can actually be drawn to.
u_int16 height() const
Returns the height of the drawable.
Class to read data from a Gzip compressed file.
s_int8 load(string fname)
Loads an animation from it's filename.
void set_height(u_int16 h)
Sets the height of the drawable.
void clear()
Clears an animation, that is put it back into the original (constructor) state.
s_int8 get(igzstream &file)
Loads an animationframe from an opened file.
void resize(u_int16 l, u_int16 h)
Resize this image.
Abstract class for drawable objects manipulation.
void set_length(u_int16 l)
Sets the length of the drawable.
Class to write data from a Gzip compressed file.
#define u_int8
8 bits long unsigned integer
#define s_int16
16 bits long signed integer
animation()
Default constructor.
bool is_open()
Returns whether the file is opened or not.
void close()
Close the file that was opened.
u_int16 length() const
Returns the length of the drawable.
~animationframe()
Destructor.
#define s_int8
8 bits long signed integer
u_int16 nbr_of_frames() const
Returns the number of frames in this animation.
u_int16 currentframe() const
Returns the index of the currently displayed frame.
u_int16 nbr_of_images() const
Returns the number of images in this animation.
s_int8 insert_image(const image *im, u_int16 pos)
Inserts an image at a given position of the image array.
Image manipulation class.
Implements "drawing zones" for drawing operations.
s_int8 put(ogzstream &file) const
Saves an animationframe into an opened file.
bool update()
Updates the animation state.
#define u_int16
16 bits long unsigned integer
void set_offset(s_int16 x, s_int16 y)
Set the global offsets of this animation.
void zoom(const surface &src)
Zooms a surface.
void next_frame()
Directly jumps to the next frame.
s_int8 insert_frame(const animationframe af, u_int16 pos)
Inserts a frame at a given position of the animationframe array.
animationframe()
Default constructor.
animation & operator=(const animation &src)
Animation copy (similar to copy ()).
s_int16 xoffset() const
Returns the global X offset of the animation.
s_int8 save(string fname) const
Saves an animation into an file, in game format, with alpha and mask values.
s_int8 get(igzstream &file)
Loads an animation from an opened file.
Class that handles animated elements, their update and their playback.