diff --git a/game.h b/game.h new file mode 100644 index 0000000..ba72c37 --- /dev/null +++ b/game.h @@ -0,0 +1,50 @@ +#pragma once + +#include "common.h" +#include "Snake.h" +#include "Food.h" +#include "RankList.h" + +class Game +{ +private: + int m_GameState; //游戏状态,0在主UI,1在游戏中,2在排行榜,3在游戏规则中 + PlayerMsg m_msg; + PlayerMsg m_msg1; //游玩数据 + PlayerMsg m_msg2; + Snake* m_snake; //蛇 + Snake* m_snake2; //蛇2 + Food* m_food; //食物 + RankList* m_ranklist; //排行榜 + +public: + Game(); + ~Game(); + void Init(); //初始化 + void Run(); //控制程序 + void Close(); //关闭程序,释放资源 + +private: + void InitData(); //初始化数据(单人) + void InitData2(); //初始化数据(双人) + void PlayGame(); //单人模式 + void PlayGame2(); //双人模式 + void ShowMainUI(); //展示主UI + void ShowRank(); //排行榜展示 + void ShowRule(); //展示规则界面 + void DrawGamePlay(); //绘制初始游戏界面(单人) + void DrawGamePlay2(); //绘制初始游戏界面(双人) + void DrawScore(); //绘制分数 + void DrawSnakeLen(); //绘制长度 + void DrawSpeed(); //绘制速度 + void DrawScore2(); //绘制分数2 + void DrawSnakeLen2(); //绘制长度2 + void DrawSpeed2(); //绘制速度2 + void DrawRunning(); //绘制正在运行 + void DrawPause(); //绘制暂停提示 + void DrawRebegin(); //绘制重新开始(单人) + void DrawRebegin2(); //绘制重新开始(双人) + void DrawGameOver(); //绘制游戏结束 + void ChangeChooseUI(int left, int top, int right, int bottom, int kind);//修改选中的选项颜色 + void ClearRegion(int left, int top, int right, int bottom); //使用黑色清除指定区域 +}; \ No newline at end of file