-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathborder.c
106 lines (101 loc) · 3.04 KB
/
border.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
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
#include <stdlib.h>
#include "border.h"
#include "camagotchi.h"
#include <curses.h>
char *outline() {
char *main_outline = "\
|-----------------------------------|\n\
| | | | |\n\
|-----------------------------------|\n\
| |\n\
| |\n\
| |\n\
| |\n\
| |\n\
| |\n\
| |\n\
| |\n\
| |\n\
| |\n\
| |\n\
| |\n\
| |\n\
|-----------------------------------|\n\
| | | | |\n\
|-----------------------------------|\n\0";
return main_outline;
}
void insert_options() {
init_pair(2, COLOR_WHITE, COLOR_BLACK);
init_pair(2, COLOR_WHITE, COLOR_BLACK);
// init_color(COLOR_TAN, 217, 220, 118);
//init_pair(1, COLOR_TAN, COLOR_TAN);
attroff(COLOR_PAIR(1));
attron(COLOR_PAIR(2));
mvaddstr(1, 1, " FEED ");
attroff(COLOR_PAIR(2));
attron(COLOR_PAIR(1));
mvaddstr(1, 10, " LITE ");
mvaddstr(1, 19, " PLAY ");
mvaddstr(1, 28, " MEDS ");
mvaddstr(17, 1, " DUCK ");
mvaddstr(17, 10, " HLTH ");
mvaddstr(17, 19, " DISC ");
mvaddstr(17, 28, " ");
}
void edit_options(int cursor, Game *game, int is_on) {
switch(cursor) {
case 0:
mvaddstr(1, 1, " FEED ");
break;
case 1:
mvaddstr(1, 10, " LITE ");
break;
case 2:
mvaddstr(1, 19, " PLAY ");
break;
case 3:
mvaddstr(1, 28, " MEDS ");
break;
case 4:
mvaddstr(17, 1, " DUCK ");
break;
case 5:
mvaddstr(17, 10, " HLTH ");
break;
case 6:
mvaddstr(17, 19, " DISC ");
break;
case 7:
if (is_on == 1) {
mvaddstr(17, 28, " ATTN ");
} else {
if ((game->cam)->attention == 1) {
mvaddstr(17, 28, " ATTN ");
} else {
mvaddstr(17, 28, " ");
}
}
break;
}
}
void move_cursor(Game *game, int key) {
// init_pair(1, COLOR_BLACK, COLOR_WHITE);
edit_options(game->current_option, game, 0);
attroff(COLOR_PAIR(1));
attron(COLOR_PAIR(2));
if (key == KEY_LEFT) {
game->current_option--;
if (game->current_option == -1) {
game->current_option = 7;
}
} else if ((key == KEY_RIGHT) || (key == 'b')) {
game->current_option++;
if (game->current_option == 8) {
game->current_option = 0;
}
}
edit_options(game->current_option, game, 1);
attroff(COLOR_PAIR(2));
attron(COLOR_PAIR(1));
}