General refactor and minor improvements

This commit is contained in:
2025-10-18 18:56:28 +02:00
parent 103f85d07e
commit 6b0e858064
13 changed files with 616 additions and 466 deletions

View File

@@ -5,8 +5,7 @@
#include "manual.h"
#include <ncurses.h>
#include "rooster.h"
#include "grid_game_engine.h"
void manual(const coordinate display_location) {
erase();
@@ -15,19 +14,22 @@ void manual(const coordinate display_location) {
return;
}
rooster *grid = grid_from_file(fp);
grid *grid = grid_create_from_file(fp);
if (grid == NULL) {
mvaddstr(display_location.y, display_location.x, "Error loading grid");
return;
}
fclose(fp);
show_grid_on_offset(grid, display_location.x, display_location.y);
rooster_klaar(grid);
int ch = getch();
while (ch != KEY_ESCAPE && ch != KEY_BACKSPACE && ch != ' ') {
ch = getch();
// Wait until ESCAPE or BACKSPACE is pressed.
timeout(200);
for (int ch = getch(); ch != KEY_ESCAPE && ch != KEY_BACKSPACE && ch != ' '; ch = getch()) {
// Update the screen in the meantime to accommodate windows resizes.
show_grid_on_offset(grid, display_location.x, display_location.y);
}
grid_cleanup(grid);
}