-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutil.c
65 lines (61 loc) · 1.52 KB
/
util.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
54
55
56
57
58
59
60
61
62
63
64
65
#include "main.h"
KEY keyInput(){
char key = getch();
switch(key) {
case 'w': // UP / PRA CIMA
case 'W':
case 'H':
return UP;
case 's': // DOWN / PRA BAIXO
case 'S':
case 'P':
return DOWN;
case 'a': // LEFT / ESQUERDA
case 'A':
case 'K':
return LEFT;
case 'd': // RIGHT / ESQUERDA
case 'D':
case 'M':
return RIGHT;
case 'z': // AÇÃO
case 'Z':
case 13:
return ACTION;
case 'x':
case 'X': // CANCEL
return CANCEL;
case 27:
return ESC;
default: // DEFAULT
return NONE;
};
Sleep(100);
};
void moveCursorTo(int x, int y) {
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
void SetColor(int color) {
WORD charColor;
HANDLE OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO csbi;
if(GetConsoleScreenBufferInfo(OutputHandle, &csbi)) {
//Mask out all but the background attribute, and add in the foreground color
charColor = (csbi.wAttributes & 0xF0) + (color & 0x0F);
SetConsoleTextAttribute(OutputHandle, charColor);
};
};
/*void init(Scenes* screens){
screens->first = screens->last = NULL;
for(int i = 0; i < 4; i++){
createScreen(screens, i);
}
//PLAYING = true;
//SELECTED = 1;
//ScreenID = MAIN_MENU;
//printScreen(findScreen(screens, ScreenID));
};
*/