GLLib: GLLibPlayer : AnimationPlayer

GLLib

GLLibPlayer : AnimationPlayer
[GLLibPlayer]

ASprite animation player. More...

Functions

final int GetAnim ()
 get animation
final int GetDuration ()
 Get the duration of the current frame of the current animation.
final int GetFrame ()
 get current frame nb
int GetNbanim ()
 Get the animation count of the current sprite.
int GetNbFrame ()
 Get the frame count of the current animation.
final ASprite GetSprite ()
 Get the current sprite.
final int GetTransform ()
 get current sprite transformation
 GLLibPlayer (ASprite sprite, int x, int y)
 Basic constructor.
 GLLibPlayer ()
 Empty constructor.
boolean IsAnimOver ()
 Query the state of the current animation to see if its over.
void Render ()
 Render the curreny animation in GLLib curent graphic context.
void Reset ()
 Reset the current player.
void SetAnim (int anim, int nbLoop)
 Set a new animation number to play.
final void SetAnim (int anim)
 Set a new animation number to play, animation will loop forever.
int SetFrame (int frame)
 Set a new frame position in the current animation.
final void SetPos (int x, int y)
 Set new position of sprite.
void SetSprite (ASprite sprite)
 Set a new ASprite reference in the player.
final void SetTransform (int transform)
 set current sprite transformation
void Update (int DT)
 Update current animation time from 1 time unit.
final void Update ()
 Update current animation time from 1 time unit.

Variables

int curFlags
 Sprite player current display flags.
int curTime
 Sprite current time. Used for frame that stay on screen longer than a frame.
int posX
 Sprite player current X position.
int posY
 Sprite player current Y position.
ASprite sprite
 Sprite player current ASprite reference.

Detailed Description

ASprite animation player.

GLLibPlayer need to be instanciated to use those function


Function Documentation

final int GetAnim (  )  [package, inherited]

get animation

Returns:
current selected animation, -1 if none

final int GetDuration (  )  [package, inherited]

Get the duration of the current frame of the current animation.

Returns:
The duration of the current frame of the current animation or 0 if the animation is not set.

final int GetFrame (  )  [package, inherited]

get current frame nb

Returns:
current frame nb in current animation, result is invalid if no animation is set

int GetNbanim (  )  [package, inherited]

Get the animation count of the current sprite.

Returns:
The animation count of the current sprite.

int GetNbFrame (  )  [package, inherited]

Get the frame count of the current animation.

Returns:
The frame count of the current animation or -1 if the animation is not set.

final ASprite GetSprite (  )  [package, inherited]

Get the current sprite.

final int GetTransform (  )  [package, inherited]

GLLibPlayer ( ASprite  sprite,
int  x,
int  y 
) [package, inherited]

Basic constructor.

Default constructor to use to Play some animations.

Parameters:
sprite Sprite to use by this player. The player will only keep a reference to the ASprite eg it won't be copied.
x Ininital X Position of the player.
y Ininital Y Position of the player.

GLLibPlayer (  )  [package, inherited]

Empty constructor.

Note:
It is up to user to fill all information.

boolean IsAnimOver (  )  [package, inherited]

Query the state of the current animation to see if its over.

Returns:
True if the current animation is over.

void Render (  )  [package, inherited]

Render the curreny animation in GLLib curent graphic context.

The animation will be drawn at posX,posY.

See also:
GLLib.setCurrentGraphics

void Reset (  )  [package, inherited]

Reset the current player.

The player will be in the same state as if you would have called the empty constructor.

Note:
Usefull only on the ASprite player, no effect on the sound.

void SetAnim ( int  anim,
int  nbLoop 
) [package, inherited]

Set a new animation number to play.

Parameters:
anim Animation number to play
nbLoop how many time this animation should loop (-1 for forever)(cannot be 0)
Note:
if an animation is currently playing, and try a setanim on the same anim . nothing is done, do SetAnim(-1, 1);SetAnim(anim, loop) to force an update

final void SetAnim ( int  anim  )  [package, inherited]

Set a new animation number to play, animation will loop forever.

Parameters:
anim Animation number to play. The animation will reset the next frame to play of this new animation to 0.
Note:
if an animation is currently playing, and try a setanim on the same anim . nothing is done, do SetAnim(-1, 1);SetAnim(anim, loop) to force an update
Deprecated:
use SetAnim (int anim, int nbLoop) instead

int SetFrame ( int  frame  )  [package, inherited]

Set a new frame position in the current animation.

Parameters:
frame New frame postion.
Returns:
Frame adjusted if frame was larger than the frame count. Ex: if you ask for frame 7 of a 5 frame animation, this call will place the frame at 2. return -1 if no animation
Note:
In DEBUG, there will be an assert if frame is smaller than 0, but not in RELEASE.

final void SetPos ( int  x,
int  y 
) [package, inherited]

Set new position of sprite.

Parameters:
x Sprite new X Position.
y Sprite new Y Position.
Note:
There are no validation of the new position, it can be outside of the screen. You can also access directly the posX and posY variables.

void SetSprite ( ASprite  sprite  )  [package, inherited]

Set a new ASprite reference in the player.

This call will also reset the animation number.

Parameters:
sprite Sprite to be used from now on. If the sprite is null, this will remove the reference to any sprite from this player.

final void SetTransform ( int  transform  )  [package, inherited]

void Update ( int  DT  )  [package, inherited]

Update current animation time from 1 time unit.

If the current frame time is exceeded the current frame will be increased, if the current frame reach the animation frame count, the current frame will be looped to 0.

Parameters:
DT nb of time unit elapsed since last frame

final void Update (  )  [package, inherited]

Update current animation time from 1 time unit.

If the current frame time is exceeded the current frame will be increased, if the current frame reach the animation frame count, the current frame will be looped to 0.

Deprecated:
use void Update(int DT) instead


Variable Documentation

int curFlags [package, inherited]

Sprite player current display flags.

int curTime [inherited]

Sprite current time. Used for frame that stay on screen longer than a frame.

int posX [package, inherited]

Sprite player current X position.

int posY [package, inherited]

Sprite player current Y position.

ASprite sprite [package, inherited]

Sprite player current ASprite reference.


Generated on Tue Sep 23 23:05:31 2008 for GLLib by  doxygen 1.5.2