-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
53 lines (44 loc) · 1.31 KB
/
main.c
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
#include <windows.h>
#include <time.h>
#include "sources/intro/intro.h"
#include "sources/init/init.h"
#define WIDTH 80
#define HIGHT 40
int numOfTank = 5;
info tank[10];
info bulets[200];
int tankPositive[39][79];
int play = 1;
int main(int argc, char const * argv[]){
// init console screen
HANDLE rhnd = GetStdHandle(STD_INPUT_HANDLE);
HANDLE whnd = GetStdHandle(STD_OUTPUT_HANDLE);
//set window
SetConsoleTitle(TEXT("TANK BATTLE"));
SMALL_RECT windowSize = {0, 0, WIDTH -1, HIGHT -1};
SetConsoleWindowInfo(whnd, TRUE, &windowSize);
//set buffer size
COORD bufferSize = {WIDTH, HIGHT};
SetConsoleScreenBufferSize(whnd, bufferSize);
//hide curso
CONSOLE_CURSOR_INFO info;
info.dwSize = 100;
info.bVisible = FALSE;
SetConsoleCursorInfo(whnd, &info);
//array of console buffer
CHAR_INFO consoleBuffer[HIGHT][WIDTH];
while (play){
// intro the game
intro(consoleBuffer);
// init game
init(consoleBuffer, tank, numOfTank);
// game loop
COORD charBufSize = {WIDTH, HIGHT};
COORD charPos = {0, 0};
SMALL_RECT writeArea = {0, 0, WIDTH - 1, HIGHT - 1};
WriteConsoleOutputA(whnd, consoleBuffer, charBufSize, charPos, &writeArea);
getchar();
//Sleep(100000);
}
return 0;
}