-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
48 lines (33 loc) · 765 Bytes
/
Copy pathmain.c
File metadata and controls
48 lines (33 loc) · 765 Bytes
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
#include <stdio.h>
#include <ncurses.h>
#include <time.h>
#include "src/Screen/Screen.h"
#include "src/Game/Game.h"
void delay(int milliseconds);
int main(int argc, char** argv) {
Screen* screen = _Screen();
initscr();
refresh();
clear();
noecho();
curs_set(false);
Game* game = _Game(screen);
while (!game->is_over) {
process_input(game);
update_state(game);
redraw(game);
}
delay(1000);
endwin();
system("clear");
printf("GAMEOVER\nThanks for playing\n");
return 0;
}
void delay(int milliseconds) {
long pause;
clock_t now,then;
pause = milliseconds*(CLOCKS_PER_SEC/1000);
now = then = clock();
while( (now-then) < pause )
now = clock();
}