![]() |
The LARC Game Engine
A Simple Game Engine from the Laboratory for Recreational Computing
|
The sprite. More...
#include <Sprite.h>
Public Member Functions | |
CSprite (size_t) | |
Contructor. More... | |
~CSprite () | |
Destructor. More... | |
CTextureDesc & | GetTextureDesc (const size_t=0) |
Get texture descriptor. More... | |
const float | GetWidth (const UINT=0) const |
Get sprite width. More... | |
const float | GetHeight (const UINT=0) const |
Get sprite height. More... | |
void | GetSize (const UINT, float &, float &) const |
Get sprite width and height. More... | |
const size_t | GetNumFrames () const |
Get number of frames. More... | |
Additional Inherited Members | |
![]() | |
static CStepTimer * | m_pStepTimer = &cStepTimer |
Pointer to a step timer. More... | |
static CRandom * | m_pRandom = &cRandom |
Pointer to a PRNG. More... | |
static CKeyboard * | m_pKeyboard = &cKeyboard |
Pointer to a keyboard handler. More... | |
static CXBoxController * | m_pController = &cController |
Pointer to a XBox controller. More... | |
static CAudio * | m_pAudio = &cAudio |
Pointer to an audio player. More... | |
A sprite consists of textures for its animation frames and the associated texture information.
CSprite::CSprite | ( | size_t | n | ) |
Create the texture descriptor array.
n | Number of animation frames. |
CSprite::~CSprite | ( | ) |
Clean up the texture descriptor array.
const float CSprite::GetHeight | ( | const UINT | n = 0 | ) | const |
Reader function for the height of a frame.
n | Frame number, assumed to be in range, defaults to zero. |
const size_t CSprite::GetNumFrames | ( | ) | const |
Reader function for the number of animation frames.
void CSprite::GetSize | ( | const UINT | n, |
float & | x, | ||
float & | y | ||
) | const |
Reader function for the width and height of a frame.
n | [in] Frame number, assumed to be in range. |
x | [out] Width of frame in pixels. |
y | [out] Height of frame in pixels. |
CTextureDesc & CSprite::GetTextureDesc | ( | const size_t | i = 0 | ) |
Reference function for the texture descriptor for an animation frame. Note that the texture descriptor can be modified using the reference returned by this function.
i | Frame number, defaults to zero. |
const float CSprite::GetWidth | ( | const UINT | n = 0 | ) | const |
Reader function for the width of a frame.
n | Frame number, assumed to be in range, defaults to zero. |