Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

animation_c Class Reference

Animation class. More...

#include <image.h>

Inheritance diagram for animation_c:

image_c

Public Methods

void set_framecount (ushort f)
 set frame count

image_cset_frame (ushort f)
 set frame

bool load (char *filename)
 load frames

void set_fps (ushort f)
 set frame rate

void play (sshort type)
 play animation

void stop ()
 stop animation

const char * get_pixels ()
 get pixel buffer


Protected Attributes

ushort framecount
 total frame count

ushort fps
 frames per second

sshort frame
 current frame

ulong nextframetime
 time for next frame switch

image_cimg
 the img with frames

sshort playdir
 play direction

sshort playtype
 type of play


Detailed Description

This class contains a number of frames in a single image_c. An animation consists of an image in which the frames are arranged horizontally. You can load an animation using load() for that image and then calling set_framecount() to split the image into frames. You can either use set_frame() to select a single frame or you can play an animation by using play().

Definition at line 344 of file image.h.


Member Function Documentation

const char * get_pixels  
 

Returns the pixel buffer for current frame.

Definition at line 847 of file x_image.cpp.

References image_c::get_pixels().

bool load char *    filename
 

Loads an image containing the frames from a file and stores it in img. Return true if loading was successful, false otherwise.

Parameters:
filename  file name of image

Definition at line 773 of file x_image.cpp.

void play sshort    type
 

Starts playing the animation using the given way:

  • ANIM_ONESHOT The animation is only played once, then stops
  • ANIM_LOOP The animation plays over and over again
  • ANIM_PINGPONG The animation plays forth and back
Parameters:
type  playing type

Definition at line 830 of file x_image.cpp.

void set_fps ushort    f
 

If you want to play an animation you have to set the frame rate first.

Parameters:
f  new framerate

Definition at line 806 of file x_image.cpp.

image_c * set_frame ushort    f
 

Sets the current frame by blitting it from the loaded image and then returns itself (just for convenience).

Parameters:
f  new frame

Definition at line 817 of file x_image.cpp.

Referenced by uiwindow_c::paint(), uislider_c::paint(), and uicheckbutton_c::paint().

void set_framecount ushort    f
 

Sets the number of frames that can be found in the loaded image. The image will be splitted in that way the frames are arranged horizontally in the unsplitted image.

Parameters:
f  new number of frames

Definition at line 791 of file x_image.cpp.

References image_c::create().

void stop  
 

Stops a playing animation


The documentation for this class was generated from the following files:
Generated on Wed Dec 18 15:48:49 2002 for omicron engine by doxygen1.2.18