cgameframework.h

来自「symbian 的一个 二维飞行游戏 源码 及相关技术文章」· C头文件 代码 · 共 57 行

H
57
字号
// Copyright 2002 Kenneth Guy,
// 
// CGameFramework.h

#ifndef _CGAMEFRAMEWORK_H_
#define _CGAMEFRAMEWORK_H_

/** \file CGameFramework.h 
    defines class CGameFramework */


#include <e32std.h>
#include <e32base.h>
#include <w32std.h>

#include "TGameData.h"

/** Provides UI with access to CGame, and CGame access to the UI.

    Loads levels, starts/suspends the thread that owns the CGame
    object, talks direct to the window server to collect key presses
    and focus change events.
*/

class CGameFramework : public CBase {
public:
  /** Current state of the game */
  enum TGameState {
    EDied, ///< No game running, thread exited because player died
    ELevelCompleted, ///<  No game running, thread exited because player finished a level
    EPaused, ///< Game paused, game thread is suspended
  };

public:
  static CGameFramework* NewL();
  ~CGameFramework();

  TGameState RunL(TBool aReset);
  void LoadLevelL(const TDesC& aLevelName,const TDesC& aMapName, TBool aResetShip);
  TInt Score();
  void CancelL();

private:
  static TInt GameThread(TAny* aGameData);
  TBool Play(RWsSession &aWindSession);
private:
  
  TGameData iData; ///< Game data, key presses level information etc.
  RThread iGameThread; ///< Thread within which the CGame object runs
  TRequestStatus iGameStatus; ///< Status of game thread.

  HBufC8*        iLevel; ///< Sprite, background and status sprites for level.
  HBufC8*        iMap; ///< Map and path data for game.
};

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?