|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
#include "Snake.h"
|
|
|
|
|
#include "Food.h"
|
|
|
|
|
#include "RankList.h"
|
|
|
|
|
|
|
|
|
|
class Game
|
|
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
|
int m_GameState; //<2F><>Ϸ״̬,0<><30><EFBFBD><EFBFBD>UI<55><49>1<EFBFBD><31><EFBFBD><EFBFBD>Ϸ<EFBFBD>У<EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD>а<EFBFBD><D0B0><EFBFBD>3<EFBFBD><33><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
PlayerMsg m_msg;
|
|
|
|
|
PlayerMsg m_msg1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
PlayerMsg m_msg2;
|
|
|
|
|
Snake* m_snake; //<2F><>
|
|
|
|
|
Snake* m_snake2; //<2F><>2
|
|
|
|
|
Food* m_food; //ʳ<><CAB3>
|
|
|
|
|
RankList* m_ranklist; //<2F><><EFBFBD>а<EFBFBD>
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
Game();
|
|
|
|
|
~Game();
|
|
|
|
|
void Init(); //<2F><>ʼ<EFBFBD><CABC>
|
|
|
|
|
void Run(); //<2F><><EFBFBD>Ƴ<EFBFBD><C6B3><EFBFBD>
|
|
|
|
|
void Close(); //<2F>رճ<D8B1><D5B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>Դ
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void InitData(); //<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>)
|
|
|
|
|
void InitData2(); //<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>˫<EFBFBD>ˣ<EFBFBD>
|
|
|
|
|
void PlayGame(); //<2F><><EFBFBD><EFBFBD>ģʽ
|
|
|
|
|
void PlayGame2(); //˫<><CBAB>ģʽ
|
|
|
|
|
void ShowMainUI(); //չʾ<D5B9><CABE>UI
|
|
|
|
|
void ShowRank(); //<2F><><EFBFBD>а<EFBFBD>չʾ
|
|
|
|
|
void ShowRule(); //չʾ<D5B9><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void DrawGamePlay(); //<2F><><EFBFBD>Ƴ<EFBFBD>ʼ<EFBFBD><CABC>Ϸ<EFBFBD><CFB7><EFBFBD>棨<EFBFBD><E6A3A8><EFBFBD>ˣ<EFBFBD>
|
|
|
|
|
void DrawGamePlay2(); //<2F><><EFBFBD>Ƴ<EFBFBD>ʼ<EFBFBD><CABC>Ϸ<EFBFBD><CFB7><EFBFBD>棨˫<E6A3A8>ˣ<EFBFBD>
|
|
|
|
|
void DrawScore(); //<2F><><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD>
|
|
|
|
|
void DrawSnakeLen(); //<2F><><EFBFBD>Ƴ<EFBFBD><C6B3><EFBFBD>
|
|
|
|
|
void DrawSpeed(); //<2F><><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>
|
|
|
|
|
void DrawScore2(); //<2F><><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD>2
|
|
|
|
|
void DrawSnakeLen2(); //<2F><><EFBFBD>Ƴ<EFBFBD><C6B3><EFBFBD>2
|
|
|
|
|
void DrawSpeed2(); //<2F><><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>2
|
|
|
|
|
void DrawRunning(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void DrawPause(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3>ʾ
|
|
|
|
|
void DrawRebegin(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¿<EFBFBD>ʼ(<28><><EFBFBD><EFBFBD>)
|
|
|
|
|
void DrawRebegin2(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¿<EFBFBD>ʼ<EFBFBD><CABC>˫<EFBFBD>ˣ<EFBFBD>
|
|
|
|
|
void DrawGameOver(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
|
|
|
|
|
void ChangeChooseUI(int left, int top, int right, int bottom, int kind);//<2F><EFBFBD>ѡ<EFBFBD>е<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ɫ
|
|
|
|
|
void ClearRegion(int left, int top, int right, int bottom); //ʹ<>ú<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
};
|