wip refactoring file structure
This commit is contained in:
36
games/manual/manual.c
Normal file
36
games/manual/manual.c
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Created by snapshot112 on 10/17/2025
|
||||
*/
|
||||
|
||||
|
||||
#include "manual.h"
|
||||
|
||||
#include <ncurses.h>
|
||||
#include "../../engine/grid_game_engine.h"
|
||||
|
||||
void manual(const coordinate display_location) {
|
||||
erase();
|
||||
FILE *fp = fopen("assets/manual.txt", "r");
|
||||
if (fp == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
// Wait until ESCAPE or BACKSPACE is pressed.
|
||||
timeout(200);
|
||||
for (int ch = getch(); ch != KEY_ESCAPE && ch != KEY_BACKSPACE; 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);
|
||||
}
|
||||
Reference in New Issue
Block a user