Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members

Effect Class Reference

#include <effect.h>

Inheritance diagram for Effect:

Effect_changealpha Effect_counter Effect_move Effect_move_animation Effect_movebars Effect_fade Effect_tile List of all members.

Detailed Description

An Effect is some form of animation happening on the screen.

They usually operate in a restricted area of the screen and should not affect the rest. Effects are given a time limit, and they should do everything possible to stay within that.

Effects should execute when their run() method is invoked. If an effect requires parameters it should define a function called param() to take them.

Most effects do some sort of initialization in run() and then call Effect::animate() to control the timing.


Public Member Functions

virtual void run ()=0
 Runs the effect.

int get_time () const
 Gets the time limit, in milliseconds.

void set_time (int maxtime)
 Sets the time limit, in milliseconds.

int get_fps () const
 Gets the frame rate used by animate().

void set_fps (int fps)
 Sets the frame rate used by animate().


Protected Member Functions

void animate (int from, int to, int maxtime=0)
 Performs an animation by calling the step member function with values between first and last.

virtual void step (int value)=0
 A callback method that's called by animate() every frame.


Protected Attributes

int _maxtime
int _fps
int _oldval


Member Function Documentation

void Effect::animate int  from,
int  to,
int  maxtime = 0
[protected]
 

Performs an animation by calling the step member function with values between first and last.

It will do its best to stay within _maxtime milliseconds, dropping frames as necessary, but it guarantees that step will at least be called with the first and the last parameter.

virtual void Effect::run  )  [pure virtual]
 

Runs the effect.

It takes no parameters because it should be possible to run an effect without knowing its type, only knowing how long it will take. It should be possible to call run() more than once.

Implemented in Effect_move_animation, Effect_move, Effect_fade, Effect_tile, Effect_counter, and Effect_movebars.

virtual void Effect::step int  value  )  [protected, pure virtual]
 

A callback method that's called by animate() every frame.

That means it shouldn't take long to execute. Before animate() calls step() it sets Effect::_oldval to what value was at the last call.

Implemented in Effect_move_animation, Effect_move, Effect_fade, Effect_tile, Effect_counter, and Effect_movebars.


The documentation for this class was generated from the following files:
Generated on Sun Oct 19 17:34:47 2003 for rve by doxygen 1.3.3