wip refactoring file structure

This commit is contained in:
2025-10-22 15:07:52 +02:00
parent 4f6bbdd775
commit 40a3668049
55 changed files with 5309 additions and 73 deletions

View File

@@ -0,0 +1,87 @@
*--------------------------------------------*
| |
| !!! HOWTO MINIGAME !!! |
| |
| Make sure that your terminal |
| has enough space to display |
| all the output of the game. |
| |
| This can be achieved by |
| going fullscreen and/or |
| zooming out. |
| |
| *________________* |
| | GENERAL | |
| *------------------------------------* |
| | | |
| | Exit current screen: | |
| | Escape, backspace | |
| | | |
| | Reset zoom: | |
| | "'ctrl' + '0'" | |
| | | |
| | Zoom out: | |
| | "'ctrl' + '-'" | |
| | | |
| | Zoom in: | |
| | "'ctrl' + '+'" | |
| | "'ctrl' + 'shift' + '='" | |
| | | |
| *------------------------------------* |
| |
| "'ctrl' + '-'" |
| |
| You can reset the zoom with: |
| "'ctrl' + '0'" |
| |
| *________________* |
| | MENU | |
| *------------------------------------* |
| | | |
| | Move down: | |
| | 's', arrow_down | |
| | | |
| | Move up: | |
| | 'w', arrow_up | |
| | | |
| | Select: | |
| | 'f', enter, space bar | |
| | | |
| *------------------------------------* |
| |
| *-----------------* |
| | MAZE RUNNER | |
| *------------------------------------* |
| | | |
| | Move up: | |
| | 'w', arrow_up | |
| | | |
| | Move down: | |
| | 's', arrow_down | |
| | | |
| | Move right: | |
| | 'd', arrow_right | |
| | | |
| | Move left: | |
| | 'a', arrow_left | |
| | | |
| *------------------------------------* |
| |
| *-----------------* |
| | SNAKE | |
| *------------------------------------* |
| | | |
| | Turn up: | |
| | 'w', arrow_up | |
| | | |
| | Turn down: | |
| | 's', arrow_down | |
| | | |
| | Turn right: | |
| | 'd', arrow_right | |
| | | |
| | Turn left: | |
| | 'a', arrow_left | |
| | | |
| *------------------------------------* |
*--------------------------------------------*

36
games/manual/manual.c Normal file
View 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);
}

27
games/manual/manual.h Normal file
View File

@@ -0,0 +1,27 @@
/*
* Created by snapshot112 on 10/17/2025
*
* Provides a way to display the minigame manual in the assets in game.
*/
#ifndef MINIGAME_MENU_MANUAL_H
#define MINIGAME_MENU_MANUAL_H
#include "../../engine/grid_game_engine.h"
/*
* An in game manual for the minigames menu.
*
* Please make sure to include and initialize the game engine before opening the manual
*
* Input:
* display_location: The location to display the manual.
*
* Side Effects:
* Clears the console and uses it to display the manual.
*
* Controls:
* Press ESCAPE or BACKSPACE to exit the manual.
*/
void manual(coordinate display_location);
#endif //MINIGAME_MENU_MANUAL_H