control.h

来自「一个同学用C++写的小游戏」· C头文件 代码 · 共 54 行

H
54
字号
// control.h : Interface of class GameControl

#ifndef BWINDOW_H
#define BWINDOW_H

#include "Bug.h"
#include "Hunter.h"

enum GameLevel { Slow, Fast, Done };
enum GameStatus { GameWon, Playing, GameLost, SettingUp };

const int GameSpeed = 100;  // speed of game
const int DirectBmp = 4;

//------------------------------------------------------------------

class GameController
{
public:
	// constructor
	GameController( const string &Title = " ", const Position &WinPosition = Position(1.0, 1.0 ),
		            const float WindLength = 17.0, const float WinHeight = 13.0 );
    // destructor
	~GameController();

	SimpleWindow* GetGameWindow();                     // a pointer to the SimpleWindow for the Game
	SimpleWindow* GetControlWindow();                  // a pointer to the SimpleWindow for the Control

	void Reset();                                      // put the game back in its initial state
	void Play( const GameLevel Level );                // start the game

	int MouseClick( const Position &MousePosition );   // mouse event for control window
	int TimerTick();                                   // Timer event for game window

private:
	void BugHit();                                    // whether the hunter hit the bug
	GameLevel BugLevel() const;                       // the current level of the game
	Bug* CurrentBug() const;
	void InitBitMap();

	SimpleWindow* GameWindow;
	SimpleWindow* ControlWindow;

	Hunter* m_Hunter;
	vector<Bug*> KingOfBug;
	vector<BitMap> m_vbDirectBmp;

	GameLevel Level;
	GameStatus Status;
};
#endif

//-------------------------------------------------------
// end

⌨️ 快捷键说明

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