StarTrekV3_Linux  Version3
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Pages
TSprite Class Reference

#include <Engine.h>

Inherited by TAnimation, TBullet, TParticle, TProbe, TShip, and TSpaceObject.

Public Member Functions

virtual void Draw (double a_dCamX, double a_dCamY)
 ** VIRTUAL ** Draw the sprite. is sprite and camera are in the same position, the sprite will be in the middle of the screen ! Called by Engine More...
 
virtual void Move (double a_dLagCount)
 ** VIRTUAL ** Move the sprite according to its speed. Called by Engine More...
 
virtual void Do_ai ()
 ** VIRTUAL ** Enter AI routine Called by Engine More...
 
virtual void DoCollision (TSprite *const a_pSprite)
 ** VIRTUAL ** Handle collision if m_blCanCollide is true Called by Engine More...
 
void SetPosition (double a_dX, double a_dY, double a_dAngle)
 Sets the position of this sprite. More...
 
void SetPosition (double a_dX, double a_dY)
 Sets the position of this sprite. More...
 
void SetHeight (int a_nHeight)
 Sets the Height Z position ( drawing order) More...
 
void SetSpeed (double a_dSpeed)
 Sets the Speed. More...
 
void SetImage (ALLEGRO_BITMAP *a_pImage)
 Sets the Image of the sprite. More...
 
double GetX ()
 Get the X position. More...
 
double GetY ()
 Get the Y position. More...
 
 TSprite ()
 Basic sprite constructor. More...
 
virtual ~TSprite ()
 

Public Attributes

bool m_blDestroyed
 
bool m_blCanCollide
 
bool m_blCanFind
 
MEMBER m_Member
 A sprite can be associated with a certain group (Federation, Klingon etc.) More...
 
ID m_ID
 an ID providig some runtime type information More...
 

Protected Attributes

TEnginem_pEngine
 Pointer to the engine. More...
 
ALLEGRO_BITMAP * m_pImage
 pointer to a bitmap representing this sprite More...
 
int m_nZ
 Z drawing order ( Depth) More...
 
double m_dAngle
 
double m_dX
 
double m_dY
 
double m_dSpeed
 
int m_nBitmapWidth
 
int m_nBitmapHeight
 
int m_nBitmapMidX
 
int m_nBitmapMidY
 

Friends

class TEngine
 
bool Comp (const TSprite *a_pV1, const TSprite *a_p_V2)
 Compare function for Z sorting. Compares the Z value of the sprites passed through the pointers. More...
 

Detailed Description

TSprite is the basic sprite class where all sprite classes should be derived from. a TSprite can be handled and drawn by the Engine

Constructor & Destructor Documentation

TSprite::TSprite ( )

Basic sprite constructor.

TSprite::~TSprite ( )
virtual

Member Function Documentation

void TSprite::Do_ai ( )
virtual

** VIRTUAL ** Enter AI routine Called by Engine

Reimplemented in TAnimation, TEnterprise, TRomulanBop, TKlingonBOP, TBullet, TFederation_Ship, TKlingonBC, TStarbase, TParticle, TSpaceObject, and TProbe.

void TSprite::DoCollision ( TSprite *const  a_pSprite)
virtual

** VIRTUAL ** Handle collision if m_blCanCollide is true Called by Engine

Parameters
TSprite* const a_pSprite a sprite that collided with this one.

Reimplemented in TShip.

void TSprite::Draw ( double  a_dCamX,
double  a_dCamY 
)
virtual

** VIRTUAL ** Draw the sprite. is sprite and camera are in the same position, the sprite will be in the middle of the screen ! Called by Engine

Parameters
doublea_dCamX X position of the CENTER of the camera
doublea_dCamY X position of the CENTER of the camera

Reimplemented in TShip, TBullet, TProbe, and TParticle.

double TSprite::GetX ( )

Get the X position.

Returns
X Position of the sprite
double TSprite::GetY ( )

Get the Y position.

Returns
Y Position of the sprite
void TSprite::Move ( double  a_dLagCount)
virtual

** VIRTUAL ** Move the sprite according to its speed. Called by Engine

Parameters
doublea_dLagCount The lagtime since the last cycle
void TSprite::SetHeight ( int  a_nHeight)

Sets the Height Z position ( drawing order)

Parameters
inta_nHeight Z position
void TSprite::SetImage ( ALLEGRO_BITMAP *  a_pImage)

Sets the Image of the sprite.

Parameters
ALLEGRO_BITMAP* a_pImage Bitmap representing the sprite
void TSprite::SetPosition ( double  a_dX,
double  a_dY,
double  a_dAngle 
)

Sets the position of this sprite.

Parameters
doublea_dX X position
doublea_dY Y position
doublea_dAngle Rotation angle
void TSprite::SetPosition ( double  a_dX,
double  a_dY 
)

Sets the position of this sprite.

Parameters
doublea_dX X position
doublea_dY Y position
void TSprite::SetSpeed ( double  a_dSpeed)

Sets the Speed.

Parameters
doublea_dSpeed Velocity

Friends And Related Function Documentation

bool Comp ( const TSprite a_pV1,
const TSprite a_p_V2 
)
friend

Compare function for Z sorting. Compares the Z value of the sprites passed through the pointers.

Parameters
constTSprite * a_pV1 Pointer to first sprite.
constTSprite * a_p_V2 Pointer to secons sprite.
Returns
true if the first sprite has a greater Z value than the second.
friend class TEngine
friend

Member Data Documentation

bool TSprite::m_blCanCollide
bool TSprite::m_blCanFind
bool TSprite::m_blDestroyed
double TSprite::m_dAngle
protected
double TSprite::m_dSpeed
protected
double TSprite::m_dX
protected
double TSprite::m_dY
protected
ID TSprite::m_ID

an ID providig some runtime type information

MEMBER TSprite::m_Member

A sprite can be associated with a certain group (Federation, Klingon etc.)

int TSprite::m_nBitmapHeight
protected
int TSprite::m_nBitmapMidX
protected
int TSprite::m_nBitmapMidY
protected
int TSprite::m_nBitmapWidth
protected
int TSprite::m_nZ
protected

Z drawing order ( Depth)

TEngine* TSprite::m_pEngine
protected

Pointer to the engine.

ALLEGRO_BITMAP* TSprite::m_pImage
protected

pointer to a bitmap representing this sprite


The documentation for this class was generated from the following files: