⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jewelengine.h

📁 symbian下的泡泡龙游戏源码,手机游戏开放新手学习的好资料
💻 H
字号:
/*
* ============================================================================
*  Name     : CJewelEngine from JewelEngine.h
*  Part of  : Jewel
*  Created  : 02.10.2005 by Thosing
*  Description:
*     Declares JewelEngine for application.
*  Version  : 0.1
*  Copyright: Another
* ============================================================================
*/

#ifndef JEWELENGINE_H
#define JEWELENGINE_H

#include "JewelView.h"

#define FLASH_KILL_TIMES  3

class CJewelEngine : public CBase {
public:

  ~CJewelEngine(void);	//destructor
  void ConstructL(CJewelView* aJewelView); //Constructor leave
  void KeyPressed(TInt aScanCode);	//key	   
  void FlushGameboard();			//board
  TInt Life() { return iLife; }		//life		
  TInt Marks() {return iMark; }		//mark

  //Jewel
  TInt BoardJewel(TInt aPos) { 
    if(aPos>=0 && aPos<BOARD_SIZE_X * BOARD_SIZE_Y) return iBoardJewels[aPos];
    else return -1;
  }
  TInt BoardJewel(TInt aX, TInt aY) {
    if(aX>=0 && aX<BOARD_SIZE_X && aY>=0 && aY<BOARD_SIZE_Y) 
      return iBoardJewels[aY*BOARD_SIZE_X+aX];
    else
      return -1;
  }
  
  void Delay(TInt64 aMicroSecond, TBool aRedraw=EFalse);//delay


  //mark
  TBool IsJewelMasked(TInt aPos);
  void SetJewelMasked(TInt aPos);
  void MaskJewelsAll(TBool aMask=ETrue);

  TInt GetMarks();

  //time tick
  static TInt Tick(TAny* obj) {((CJewelEngine*)obj)->NextTick(); return 1; }

  void FullLife() {iLife=100;} //life

  //score
  static void SaveHighScore(TInt hs);
  static TInt LoadHighScore();

  TBool IsGameOver() {return iGameOver;} //game over?

private:
  void NextTick();					//next tick
  TBool GetKillList(TInt aPos);		//kill
  TBool GetKillListAll();

  void Drop();

  void FlashKilled();

  //swap
  void SwapJewels(TInt aPosA, TInt aPosB) {
    TInt tmpID=iBoardJewels[aPosA];
    iBoardJewels[aPosA]=iBoardJewels[aPosB];
    iBoardJewels[aPosB]=tmpID;
  }

private:
  CPeriodic*     iTimer;		//timer
  CJewelView*    iGameView;		//view
  TInt           iBoardJewels[BOARD_SIZE_X * BOARD_SIZE_Y];
  TUint          iBoardMask[BOARD_SIZE_X * BOARD_SIZE_Y / sizeof(TUint)];
  TPoint         iCurrentPos;	//current postion
  TBool          iJewelSelected;//selected
  TInt           iLife;
  TInt           iMark;
  CArrayFixFlat<TInt>* iKillList;
  TBool          iGameOver;
};

#endif//JEWELENGINE_H

⌨️ 快捷键说明

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