-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsnake.h
More file actions
112 lines (103 loc) · 2.16 KB
/
snake.h
File metadata and controls
112 lines (103 loc) · 2.16 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#ifndef __snake_h__
#define __snake_h__
#include <thread>
#include <iostream>
#include <fstream>
#include <string>
#include <Windows.h>
#include <time.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <mmsystem.h>
#pragma comment(lib, "winmm.lib")
#pragma warning (disable: 4996)
//CONSTANT DEFINING
#define MAX_SIZE_SNAKE 40
#define MAX_SIZE_FOOD 4
#define MAX_SPEED 9
#define MAX_ROUND 9
#define ID_STUDENT "1912048019120490191204931912049919120547"
using namespace std;
//STRUCT DEFINING
struct MENU
{
char* choice;
char selecting;
};
struct HIGHLENGTH
{
string name;
int length;
};
//GLOBAL VARIABLES
extern HIGHLENGTH HighLength[5];
extern HIGHLENGTH NewLength;
extern POINT snake[MAX_SIZE_SNAKE];
extern POINT food[4];
extern POINT a;
extern int INDEX_ID;
extern int CHAR_LOCK;
extern int MOVING;
extern int SPEED;
extern int HEIGH_CONSOLE;
extern int WIDTH_CONSOLE;
extern int FOOD_INDEX;
extern int SIZE_SNAKE;
extern int SIZE_PLUS;
extern int STATE;
extern int ROUND;
extern bool GATE_EXIST;
extern char newgame[];
extern char highlength[];
extern char exitgame[];
extern char yes[];
extern char no[];
extern char ok[];
extern int temp;
extern int win;
//PROTOTYPE
void FixConsoleWindow();
void GotoXY(int x, int y);
bool IsValid(int x, int y);
void GenerateFood();
void ResetData();
void DrawBoard(int x, int y, int width, int height);
void PrintLogo();
void PrintWinner();
MENU menugame();
void StartGame();
void ExitGame(thread& t);
void PauseGame(HANDLE t);
void DrawGate();
bool CrashGate();
void Eat();
void BlinkSnake();
void ProcessDead();
void DrawFood();
void DrawSnake();
void DeleteTail();
bool CrashWall();
bool CrashItself();
void MoveRight();
void MoveLeft();
void MoveDown();
void MoveUp();
void ProcessGate();
void ThreadFunc();
bool ContinueGame();
bool IsExistedFileName(string FileName);
bool IsValidFileName(string FileName);
void DeleteBox();
void SaveData();
void TextColor(int color, char* OutputContent);
void LoadData();
bool IsEmptyHighLengthFile();
void SaveHighLength();
void ResetHighLength();
void InitializeHighLength();
void CreateNewHighLength();
void SortHighLength();
void ShowHighLength();
void InitialGame();
#endif // !__snake_h__