-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.h
70 lines (67 loc) · 1.38 KB
/
test.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#pragma once
#include <ncurses.h>
#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <unistd.h>
#include <ctime>
#include <chrono>
#include <vector>
typedef struct CharPos
{
int xpos;
int ypos;
CharPos(int x, int y);
CharPos();
}CharPos;
class SnakeGame
{
private:
WINDOW *gameBoard;
WINDOW *scoreBoard;
WINDOW *missionBoard;
int maxwidth, maxheight, c;
int gWidth, gHeight;
int sWidth, sHeigth;
int mWidth, mHeight;
int cur_length, cnt_grow, cnt_poison, cnt_use_gate;
int mis_length,mis_cnt_grow,mis_cnt_poison,mis_cnt_use_gate;
char check_length,check_grow,check_poison,check_use_gate;
char direction;
char mapData[21][60];
std::vector<CharPos> wall;
int iter;
int iter_gate;
std::vector<CharPos> snake;
CharPos growth_item;
CharPos poison_item;
CharPos gate_one;
CharPos gate_two;
void InitWindow();
void InitGameBoard();
void InitScoreBoard();
void InitMissionBoard();
void InitChar();
void DrawMap(int n);
void DrawGameBoard();
void DrawMissionBoard();
void DrawSnake();
void MoveSnake();
void RenewMap();
void RenewBoard();
void KeyEvent(int key);
void MakeItem();
void MakeGate();
void Check(bool &flag);
void TeleportRule(int n);
bool MoveRule(int key);
bool Crash();
bool NextStage();
void GameOver();
void WinGame();
public:
SnakeGame();
~SnakeGame();
void StartGame();
};