Files
itgmania212121/stepmania/src/Sprite.h
T

71 lines
1.5 KiB
C++
Raw Normal View History

/*
-----------------------------------------------------------------------------
File: Sprite.h
Desc: A bitmap Actor that animates and moves around.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
2001-11-03 10:52:42 +00:00
#ifndef _SPRITE_H_
#define _SPRITE_H_
#include "Actor.h"
#include "RageUtil.h"
#include "RageTexture.h"
#define MAX_SPRITE_STATES 256
class Sprite: public Actor
{
public:
Sprite();
virtual ~Sprite();
virtual bool LoadFromTexture( CString sTexturePath );
virtual bool LoadFromSpriteFile( CString sSpritePath );
2001-11-03 10:52:42 +00:00
virtual void Draw();
virtual void Update( float fDeltaTime );
2001-11-03 10:52:42 +00:00
virtual void StartAnimating() { m_bIsAnimating = TRUE; };
virtual void StopAnimating() { m_bIsAnimating = FALSE; };
virtual void SetState( UINT uNewState );
2001-11-03 10:52:42 +00:00
UINT GetNumStates() { return m_uNumStates; };
CString GetTexturePath() { return m_sTexturePath; };
2001-11-25 04:31:44 +00:00
void SetCustomSrcRect( FRECT new_texcoord_frect ); // for cropping
2001-11-03 10:52:42 +00:00
protected:
void Init();
2001-11-28 20:26:45 +00:00
bool LoadTexture( CString sTexture );
2001-11-03 10:52:42 +00:00
CString m_sSpritePath;
LPRageTexture m_pTexture;
CString m_sTexturePath;
UINT m_uFrame[MAX_SPRITE_STATES]; // array of indicies into m_rectBitmapFrames
2001-11-28 20:26:45 +00:00
float m_fDelay[MAX_SPRITE_STATES];
2001-11-03 10:52:42 +00:00
UINT m_uNumStates;
UINT m_uCurState;
2001-11-28 20:26:45 +00:00
bool m_bIsAnimating;
float m_fSecsIntoState; // number of seconds that have elapsed since we switched to this frame
2001-11-03 10:52:42 +00:00
2001-11-28 20:26:45 +00:00
bool m_bUsingCustomTexCoordRect;
2001-11-25 04:31:44 +00:00
FRECT m_CustomTexCoordRect;
2001-11-03 10:52:42 +00:00
};
#endif