Files
itgmania212121/stepmania/src/Sprite.h
T

73 lines
1.9 KiB
C++
Raw Normal View History

#ifndef SPRITE_H
#define SPRITE_H
/*
-----------------------------------------------------------------------------
File: Sprite.h
Desc: A bitmap Actor that animates and moves around.
2002-05-19 01:59:48 +00:00
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
2002-06-27 17:49:10 +00:00
Chris Danford
-----------------------------------------------------------------------------
*/
2001-11-03 10:52:42 +00:00
#include "Actor.h"
#include "RageUtil.h"
#include "RageTexture.h"
class Sprite: public Actor
{
public:
Sprite();
virtual ~Sprite();
2002-05-19 01:59:48 +00:00
virtual void DrawPrimitives();
virtual void Update( float fDeltaTime );
2001-11-03 10:52:42 +00:00
/* Just a convenience function; load an image that'll be used in the
* background. */
virtual bool LoadBG( RageTextureID ID );
virtual bool Load( RageTextureID ID );
void UnloadTexture();
RageTexture* GetTexture() { return m_pTexture; };
virtual void EnableAnimation( bool bEnable );
virtual void SetState( int iNewState );
2001-11-03 10:52:42 +00:00
2003-05-22 05:28:37 +00:00
virtual int GetNumStates() { return m_States.size(); };
CString GetTexturePath() { return m_pTexture==NULL ? "" : m_pTexture->GetID().filename; };
2001-11-03 10:52:42 +00:00
void SetCustomTextureCoords( const RectF &newTexCoords );
const RectF* GetCustomTextureCoords() const;
void SetCustomImageCoords( const RectF &newImageCoords ); // in image space (not texture space)
2002-03-31 07:55:25 +00:00
void StopUsingCustomCoords();
const RectF* GetActiveTextureCoords() const; // depends on m_bUsingCustomTexCoords
const RectF* GetCurrentTextureCoords() const;
2003-04-21 02:45:00 +00:00
2001-11-03 10:52:42 +00:00
protected:
virtual bool LoadFromTexture( RageTextureID ID );
virtual bool LoadFromSpriteFile( RageTextureID ID );
2002-01-16 10:01:32 +00:00
2001-11-03 10:52:42 +00:00
CString m_sSpritePath;
2002-01-16 10:01:32 +00:00
RageTexture* m_pTexture;
bool m_bDrawIfTextureNull;
2001-11-03 10:52:42 +00:00
2003-05-22 05:28:37 +00:00
struct State
{
int iFrameIndex;
float fDelay; // "seconds to show"
};
vector<State> m_States;
int m_iCurState;
2001-11-28 20:26:45 +00:00
float m_fSecsIntoState; // number of seconds that have elapsed since we switched to this frame
2001-11-03 10:52:42 +00:00
2001-12-28 10:15:59 +00:00
bool m_bUsingCustomTexCoords;
RectF m_CustomTexCoords;
2001-11-03 10:52:42 +00:00
};
#endif