wip
This commit is contained in:
BIN
deel2.tar.gz
BIN
deel2.tar.gz
Binary file not shown.
32
spel.c
32
spel.c
@@ -39,6 +39,18 @@ typedef enum {
|
|||||||
GAME_MINESWEEPER
|
GAME_MINESWEEPER
|
||||||
} game;
|
} game;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
BLACK = 1,
|
||||||
|
WHITE = 2,
|
||||||
|
BLUE = 3,
|
||||||
|
GREEN = 4,
|
||||||
|
CYAN = 5,
|
||||||
|
MAGENTA = 6,
|
||||||
|
YELLOW = 7,
|
||||||
|
RED = 8//,
|
||||||
|
// LIME = 9
|
||||||
|
} game_colors;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char name[100];
|
char name[100];
|
||||||
rooster *game_map;
|
rooster *game_map;
|
||||||
@@ -328,7 +340,13 @@ void menu_highlight(rooster *rp, const game target, const int offset_x, const in
|
|||||||
case GAME_MINESWEEPER: // Fallthrough
|
case GAME_MINESWEEPER: // Fallthrough
|
||||||
case GAME_QUIT: // Fallthrough
|
case GAME_QUIT: // Fallthrough
|
||||||
// TODO: Properly highlight this shit.
|
// TODO: Properly highlight this shit.
|
||||||
mvprintw(offset_y + (int)target, offset_x, rooster_vraag_rij(rp, target));
|
attron(COLOR_PAIR(HIGHLIGHT_COLOR));
|
||||||
|
mvaddch(y0 + y, x0 + x * 2, ' ');
|
||||||
|
addch(' ');
|
||||||
|
attroff(COLOR_PAIR(kleur));
|
||||||
|
char* row = rooster_vraag_rij(rp, target);
|
||||||
|
mvprintw(offset_y + (int)target, offset_x, row);
|
||||||
|
free(row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,6 +379,7 @@ void navigate_menu(rooster *menu, const game default_game, const int offset_x, c
|
|||||||
menu_highlight(menu, selected_game, offset_x, offset_y);
|
menu_highlight(menu, selected_game, offset_x, offset_y);
|
||||||
break;
|
break;
|
||||||
case KEY_ENTER:
|
case KEY_ENTER:
|
||||||
|
case 'p':
|
||||||
// select current game somehow
|
// select current game somehow
|
||||||
launch_game(menu, GAME_QUIT);
|
launch_game(menu, GAME_QUIT);
|
||||||
menu_highlight(menu, selected_game, offset_x, offset_y);
|
menu_highlight(menu, selected_game, offset_x, offset_y);
|
||||||
@@ -416,6 +435,17 @@ int main(void) {
|
|||||||
// mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, NULL); // Don't mask any mouse events
|
// mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, NULL); // Don't mask any mouse events
|
||||||
// printf("\033[?1003h\n"); // Makes the terminal report mouse movement events
|
// printf("\033[?1003h\n"); // Makes the terminal report mouse movement events
|
||||||
|
|
||||||
|
start_color();
|
||||||
|
init_pair(BLACK, COLOR_BLACK, COLOR_BLACK);
|
||||||
|
init_pair(WHITE, COLOR_BLACK, COLOR_WHITE);
|
||||||
|
init_pair(BLUE, COLOR_BLACK, COLOR_BLUE);
|
||||||
|
init_pair(GREEN, COLOR_BLACK, COLOR_GREEN);
|
||||||
|
init_pair(CYAN, COLOR_BLACK, COLOR_CYAN);
|
||||||
|
init_pair(MAGENTA, COLOR_BLACK, COLOR_MAGENTA);
|
||||||
|
init_pair(YELLOW, COLOR_BLACK, COLOR_YELLOW);
|
||||||
|
init_pair(RED, COLOR_BLACK, COLOR_RED);
|
||||||
|
// init_pair(LIME, COLOR_BLACK, COLOR_LIME);
|
||||||
|
|
||||||
|
|
||||||
// 5. Speel het spel.
|
// 5. Speel het spel.
|
||||||
startup_sequence();
|
startup_sequence();
|
||||||
|
|||||||
Reference in New Issue
Block a user