StarTrekV3_Linux
Version3
|
#include <Engine.h>
Public Member Functions | |
void | Move (double a_dLagCount) |
Move all sprite objects according to speed and lagtime. More... | |
void | Do_ai () |
Call AI routines of the sprites. More... | |
void | Add (TSprite *const a_pSprite) |
Add a sprite to the Engine. The engine OWNS the sprite from this moment and handles destruction. More... | |
void | Draw_sensor (int a_nX, int a_nY, TShip *const a_pPlayer) |
Draws a small sensor screen. More... | |
void | DrawHud (TShip *const a_pPlayer) |
Draws a HUD Targetline pointing to a locked ship. More... | |
void | SetOrigin (double a_dX, double a_dY) |
Sets the camera center. More... | |
void | Folow (TSprite *const a_pSprite) |
Move camera to this sprite. More... | |
void | Draw () |
Draw all spritese. More... | |
void | Kill () |
Free all destroyed sprites. More... | |
void | Sort () |
Z sort the sprites. More... | |
void | Clear (bool a_blKeepPlayer) |
Clear the engine, remove all sprites. More... | |
double | GetDx () |
Get Camera X position. More... | |
double | GetDy () |
Get Camera Y position. More... | |
TSprite * | Seek (int a_nID, double a_dViewDistance, double a_dX, double a_dY) |
Seek for a certain sprite, returns the closest sprite with given parameters. More... | |
TSprite * | Seek (int a_nMember, bool a_blEnemy, double a_dViewDistance, double a_dX, double a_dY) |
Seek for a certain sprite, returns the closest sprite with given parameters. More... | |
TSprite * | Seekstarbase (int a_nMember, bool a_blEnemy, double a_dViewDistance, double a_dX, double a_dY) |
Seek for a certain starbase with given parameters. More... | |
bool | Detect_collision (TSprite *a_pSprite1, TSprite *a_pSprite2) |
Collision detection function Circulair collision, distance based. More... | |
TEngine (int a_nWidth, int a_nHeight) | |
Engine constructor. More... | |
~TEngine () | |
Virtual Destructor. More... | |
bool | Save (ofstream &a_SaveStream) |
Saves the Engine contents to an output stream. More... | |
bool | Load (ifstream &a_LoadStream) |
Loads contents from an input stream into the Engine. More... | |
Public Attributes | |
bool | m_blSensorStatic |
int | m_nScreenWidth |
int | m_nScreenHeight |
int | m_nScreenMidX |
int | m_nScreenMidY |
ALLEGRO_COLOR | m_clBLACK |
ALLEGRO_COLOR | m_clWHITE |
ALLEGRO_COLOR | m_clGREEN |
ALLEGRO_COLOR | m_clYELLOW |
ALLEGRO_COLOR | m_clBROWN |
ALLEGRO_COLOR | m_clBLUE |
ALLEGRO_COLOR | m_clRED |
ALLEGRO_COLOR | m_clMAGENTA |
ALLEGRO_COLOR | m_clAQUA |
ALLEGRO_COLOR | m_clATHM |
bool | m_blKeys [KEY_MAX] |
Friends | |
class | TShip |
class | Sector |
This is the container class for all sprites. It handles AI calling, Moving, Collision detection and drawing. The engine position is a camera position, everything is drawn with these values as an offset. Sprites beyond the screen boundaries will not be drawn, but will have their AI code called, moved etc.
TEngine::TEngine | ( | int | a_nWidth, |
int | a_nHeight | ||
) |
Engine constructor.
int | a_nWidth Screen width |
int | a_nHeight Screenheight |
TEngine::~TEngine | ( | ) |
Virtual Destructor.
void TEngine::Add | ( | TSprite *const | a_pSprite | ) |
Add a sprite to the Engine. The engine OWNS the sprite from this moment and handles destruction.
TSprite | * const a_pSprite Pointer to a sprite |
void TEngine::Clear | ( | bool | a_blKeepPlayer | ) |
Clear the engine, remove all sprites.
bool | a_blKeepPlayer Keep the player (Enterprise) |
void TEngine::Do_ai | ( | ) |
Call AI routines of the sprites.
void TEngine::Draw | ( | ) |
Draw all spritese.
void TEngine::Draw_sensor | ( | int | a_nX, |
int | a_nY, | ||
TShip *const | a_pPlayer | ||
) |
Draws a small sensor screen.
int | a_nX screen X position |
int | a_nY screen Y position |
TShip | * const a_pPlayer Pointer to the player |
void TEngine::DrawHud | ( | TShip *const | a_pPlayer | ) |
Draws a HUD Targetline pointing to a locked ship.
TShip | * const a_pPlayer Pointer to the player |
void TEngine::Folow | ( | TSprite *const | a_pSprite | ) |
Move camera to this sprite.
TSprite | * const a_pSprite A sprite |
double TEngine::GetDx | ( | ) |
Get Camera X position.
double TEngine::GetDy | ( | ) |
Get Camera Y position.
void TEngine::Kill | ( | ) |
Free all destroyed sprites.
bool TEngine::Load | ( | ifstream & | a_LoadStream | ) |
Loads contents from an input stream into the Engine.
ifstream | & a_LoadStream The stream to deserialize from |
void TEngine::Move | ( | double | a_dLagCount | ) |
Move all sprite objects according to speed and lagtime.
double | a_dLagCount Time since last cycle |
bool TEngine::Save | ( | ofstream & | a_SaveStream | ) |
Saves the Engine contents to an output stream.
ofstream | & a_SaveStream The stream to serialize to |
TSprite * TEngine::Seek | ( | int | a_nID, |
double | a_dViewDistance, | ||
double | a_dX, | ||
double | a_dY | ||
) |
Seek for a certain sprite, returns the closest sprite with given parameters.
int | a_nID the ID of a sprite ( sprite Type) see types.h |
double | a_dViewDistance distance to X,Y to search |
double | a_dX X position of search center |
double | a_dY Y position of search center |
TSprite * TEngine::Seek | ( | int | a_nMember, |
bool | a_blEnemy, | ||
double | a_dViewDistance, | ||
double | a_dX, | ||
double | a_dY | ||
) |
Seek for a certain sprite, returns the closest sprite with given parameters.
int | a_nID the ID of a sprite ( sprite Type) see types.h |
bool | a_blEnemy Look for friend or enemy |
double | a_dViewDistance distance to X,Y to search |
double | a_dX X position of search center |
double | a_dY Y position of search center |
TSprite * TEngine::Seekstarbase | ( | int | a_nMember, |
bool | a_blEnemy, | ||
double | a_dViewDistance, | ||
double | a_dX, | ||
double | a_dY | ||
) |
Seek for a certain starbase with given parameters.
int | a_nMember the group the starbase should belong to types.h |
bool | a_blEnemy Look for friend or enemy, if enemy the function looks for a starbase belonging to an enemy of the given group |
double | a_dViewDistance distance to X,Y to search |
double | a_dX X position of search center |
double | a_dY Y position of search center |
void TEngine::SetOrigin | ( | double | a_dX, |
double | a_dY | ||
) |
Sets the camera center.
int | a_dX camera X position |
int | a_dY camera Y position |
void TEngine::Sort | ( | ) |
Z sort the sprites.
|
friend |
|
friend |
bool TEngine::m_blKeys[KEY_MAX] |
bool TEngine::m_blSensorStatic |
ALLEGRO_COLOR TEngine::m_clAQUA |
ALLEGRO_COLOR TEngine::m_clATHM |
ALLEGRO_COLOR TEngine::m_clBLACK |
ALLEGRO_COLOR TEngine::m_clBLUE |
ALLEGRO_COLOR TEngine::m_clBROWN |
ALLEGRO_COLOR TEngine::m_clGREEN |
ALLEGRO_COLOR TEngine::m_clMAGENTA |
ALLEGRO_COLOR TEngine::m_clRED |
ALLEGRO_COLOR TEngine::m_clWHITE |
ALLEGRO_COLOR TEngine::m_clYELLOW |
int TEngine::m_nScreenHeight |
int TEngine::m_nScreenMidX |
int TEngine::m_nScreenMidY |
int TEngine::m_nScreenWidth |