Woopsi 1.3
Nintendo DS Gui Framework
Classes | Public Types | Public Member Functions
WoopsiUI::Animation Class Reference

#include <libwoopsi/include/animation.h>

List of all members.

Classes

struct  AnimFrame

Public Types

enum  Status { ANIMATION_STATUS_STOPPED = 0, ANIMATION_STATUS_PLAYING = 1, ANIMATION_STATUS_PAUSED = 2 }
enum  LoopType { ANIMATION_LOOPTYPE_NONE = 0, ANIMATION_LOOPTYPE_LOOP = 1, ANIMATION_LOOPTYPE_PINGPONG = 2 }

Public Member Functions

 Animation (const u8 speed, const LoopType loopType, const u16 loops)
 ~Animation ()
const AnimFramegetCurrentFrame () const
const BitmapBasegetCurrentBitmap () const
const Status getStatus () const
const u8 getSpeed () const
const LoopType getLoopType () const
const u16 getTimeToNextFrame () const
const u16 getFrameCount () const
void setSpeed (const u8 speed)
void setLoopType (const LoopType loopType)
void addFrame (const BitmapBase *bitmap, const u8 delay)
void run ()
void play ()
void stop ()
void pause ()
void goToFrame (u16 frame)

Detailed Description

Class for creating sequences of bitmaps.


Member Enumeration Documentation

Animation loop type enum.

Enumerator:
ANIMATION_LOOPTYPE_NONE 

Animation will not loop

ANIMATION_LOOPTYPE_LOOP 

Animation will loop

ANIMATION_LOOPTYPE_PINGPONG 

Animation will loop ping-pong style

Animation status enum.

Enumerator:
ANIMATION_STATUS_STOPPED 

Animation has stopped

ANIMATION_STATUS_PLAYING 

Animation is playing

ANIMATION_STATUS_PAUSED 

Animation has been paused


Constructor & Destructor Documentation

WoopsiUI::Animation::Animation ( const u8  speed,
const LoopType  loopType,
const u16  loops 
)

Constructor.

Parameters:
speedDefault speed of the animation.
loopTypeThe loop type used by the animation.
loopsThe number of loops the animation should play through. If this is set to 0, the animation loops infinitely.
WoopsiUI::Animation::~Animation ( ) [inline]

Destructor.


Member Function Documentation

void WoopsiUI::Animation::addFrame ( const BitmapBase bitmap,
const u8  delay 
)

Add a new frame to the animation.

Parameters:
bitmapPointer to the bitmap to use in the new frame.
delayA frame-specific delay to make this frame appear longer than other frames (measured in VBLs).
const BitmapBase* WoopsiUI::Animation::getCurrentBitmap ( ) const [inline]

Get the bitmap from the current animation frame.

Returns:
The current frame's bitmap.
const AnimFrame* WoopsiUI::Animation::getCurrentFrame ( ) const [inline]

Get the current animation frame.

Returns:
The current animation frame.
const u16 WoopsiUI::Animation::getFrameCount ( ) const [inline]

Gets the total number of frames in the animation.

Returns:
The total number of frames.
const LoopType WoopsiUI::Animation::getLoopType ( ) const [inline]

Get the animation's loop type.

Returns:
The animation's loop type.
const u8 WoopsiUI::Animation::getSpeed ( ) const [inline]

Get the speed of the animation.

Returns:
The animation speed.
const Status WoopsiUI::Animation::getStatus ( ) const [inline]

Get the current status of the animation - stopped, playing or paused.

Returns:
The current animation status.
const u16 WoopsiUI::Animation::getTimeToNextFrame ( ) const [inline]

Get the number of VBLs until the next frame is displayed. This includes any delay that the current frame specifies.

Returns:
The number of VBLs until the next frame.
void WoopsiUI::Animation::goToFrame ( u16  frame)

Jump to the specified frame.

Parameters:
frameThe frame to jump to.
void WoopsiUI::Animation::pause ( ) [inline]

Pause the animation.

void WoopsiUI::Animation::play ( )

Start the animation.

void WoopsiUI::Animation::run ( )

Run the animation. Should be called every frame.

void WoopsiUI::Animation::setLoopType ( const LoopType  loopType) [inline]

Set the loop type of the animation.

Parameters:
loopTypeThe new loop type.
void WoopsiUI::Animation::setSpeed ( const u8  speed) [inline]

Set the speed of the animation.

Parameters:
speedThe new speed of the animation.
void WoopsiUI::Animation::stop ( )

Stop the animation - does not reset the current frame as doing so will cause the animation to jump back to the first frame when it ends.


The documentation for this class was generated from the following file:
 All Classes Functions Variables Enumerations Enumerator