gamecontroler.h
来自「对C++初学者有很大的帮助」· C头文件 代码 · 共 46 行
H
46 行
// GameControler.h: interface for the GameControler class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_GAMECONTROLER_H__24C993E2_9EE9_4912_B3CB_B3221EB5C57F__INCLUDED_)
#define AFX_GAMECONTROLER_H__24C993E2_9EE9_4912_B3CB_B3221EB5C57F__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "bug.h"
enum GameLevel { Slow, Fast, Done };
enum GameStatus {GameWon, Playing, GameLost, SettingUp };
// Speed of game (i.e. timer interval)
const int GameSpeed = 100;
// Types of bugs, this should match the number of
// game levels (Slow + Fast = 2)
const int NumberOfBugTypes = 2;
class GameController {
public:
GameController(const string &Title = "Bug Hunt!",
const Position &WinPosition = Position(3.0, 3.0),
const float WindLength = 14.0,
const float WinHeight = 10.0);
~GameController();
SimpleWindow *GetWindow();
void Reset();
void Play(const GameLevel Level);
int MouseClick(const Position &MousePosition);
int TimerTick();
private:
void BugHit();
GameLevel CurrentLevel() const;
Bug *CurrentBug() const;
SimpleWindow *GameWindow;
GameLevel Level;
GameStatus Status;
vector<Bug*> KindOfBug;
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?