📄 cgame.h
字号:
// Copyright 2002 Kenneth Guy,
//
// CGame.h
#ifndef _CGAME_H_
#define _CGAME_H_
/** \file CGame.h
defines class CGame */
#include <e32std.h>
#include "CMap.h"
#include "RScreenUtils.h"
#include "RStatus.h"
#include "TLevelData.h"
class TSprite32x24;
class TBadGuy;
class TPlayersShip;
class TBullet;
class TGameData;
/** Runs each level of the game.
This owns the game objects (map, badguys, bullets, status and players ship)
then Play() loops. Each loops checks the keys pressed, moves things, plots
everything, copies the offscreen map to the screen, removes everything,
checks collisions and scrolls the map. It does this until the player
dies, quits or completes the level. The thread within which this
runs is suspended when the game is paused so this code knows nothing
about pausing.
*/
class CGame : public CBase {
public:
/** Types of bonus that can be collected */
enum TGameBonus {
EBonusLife, ///< Extra life
EBonusPowerup ///< Increase the power of one bullet
};
public:
static CGame* NewL(TGameData& aData);
~CGame();
void Play();
void AddBadGuy(TInt16 aType,const TInt16 aArgs[]);
void AddBadGuy(const TBadGuy &aBadGuy);
void Bonus(TGameBonus aBonus);
void AddScore(TInt aScore);
void DamageBadGuys(TInt16 aId,TInt16 aHealth);
TInt16 FirstExplosionSprite();
TInt16 LastExplosionSprite();
TInt16 MapSpeed();
private:
CGame(TGameData& aData);
void ConstructL();
void Collisions();
void RemoveEveryThing();
void DrawEveryThing();
void MoveThings();
void HandleKeys();
void Shoot();
private:
TGameData& iData; ///< Game data, lives, levels, key presses etc
TPlayersShip* iPlayersShip; ///< Players ship
TBadGuy* iBadGuys; ///< Array of bad guys
TBullet* iBullets; ///< Array of players bullets
TInt iLastFired; ///< Last bullet that was fired
CMap* iMap; ///< Offscreen map
RStatus iStatus; ///< Status screen
TInt iPowerups; ///< Number of weapon powerups collected
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -