Class Sprite

Overview

builds on [[[3dObject | c_3dObject]] by implimenting animations and a mesh, along with functions vital to a sprite.

This is a Graphics class, and thus can assume knowledge about the workings of the Graphics Engine.

c_Sprite::Load(GrEngine* eng, LPCSTR file, SPoint p)

Loads the sprite at point p. This function will also load all animations, then render one frame to ensure thay they are loaded into the GPU prior to a match.


void c_Sprite::Translate(SPoint v)

Translates the sprite according to v.


void c_Sprite::ReTranslate(SPoint v)

A different type of translate, this translates the sprite in such a way that the rtranslation is recorded, and can be undone with UnTranslate()


void c_Sprite::Pivot(double ang)

Makes the sprite pivot horizontally by a given amount


void c_Sprite::Orient(double ang)

Rotates the sprite into a given orientation


double c_Sprite::Animate(LPCSTR animName, bool loop, double startTime)

Function to play an animation.


void c_Sprite::UpdateAnim(double timeLapsed)

Function to update an animation by a given amount of time.


void c_Sprite::SetWeightedAnim(double timeWgt)

Sets the frame of the animation based on the specified value of timeWgt. timeWgt will range between 0 (beginning) and 1 (end)


void c_Sprite::SetPos()

Sets the location of the sprite. Variations are meant for 2 and 3 dimensional positioning.


Variables

std::string name : name of the current animation
STimer aniTimer : timer to assist animations
SPoint displacement : Records transalte values for ReTranslate and UnTranslate

Ogre::SceneNode* spriteNode : Ogre Sprite Node
Ogre::Entity* spriteEntity : Entity located in Sprite node
Ogre::AnimationState *animState : The current animation state of the object
};