aboutsummaryrefslogtreecommitdiff
path: root/src/defaults.h
diff options
context:
space:
mode:
authorSopár Adrián <adrian.sopar@protonmail.com>2024-06-20 09:28:14 +0200
committerSopár Adrián <adrian.sopar@protonmail.com>2024-06-20 09:28:14 +0200
commit74ea6dc86646cee9915292d73d8c7afef01ef3e0 (patch)
tree9a58866f7765dad8ba56f1f40b1fa031e9d2687d /src/defaults.h
First commit. This is mostly the state of the project as I left it around the end of 2019.HEADmaster
Diffstat (limited to 'src/defaults.h')
-rw-r--r--src/defaults.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/defaults.h b/src/defaults.h
new file mode 100644
index 0000000..d4fdc1b
--- /dev/null
+++ b/src/defaults.h
@@ -0,0 +1,48 @@
+#ifndef H_MAZE_DEFAULTS
+#define H_MAZE_DEFAULTS
+
+#include "config.h"
+#include "color.h"
+#include <ncurses.h>
+#include <stdio.h>
+
+static inline void set_blocks(struct game_blocks *game_blocks)
+{
+ game_blocks->wall = get_block(' ', false, get_color_code(COLOR_BLACK, COLOR_WHITE));
+ game_blocks->road = get_block(' ', false, get_color_code(COLOR_WHITE, COLOR_BLACK));
+ game_blocks->path = get_block(0x2022, false, get_color_code(COLOR_YELLOW, COLOR_BLACK));
+ game_blocks->solve = get_block(0x2022, false, get_color_code(COLOR_BLUE, COLOR_BLACK));
+ game_blocks->player = get_block(0x25CF, false, get_color_code(COLOR_CYAN, COLOR_BLACK));
+ game_blocks->start = get_block('S', true, get_color_code(COLOR_GREEN, COLOR_BLACK));
+ game_blocks->target = get_block('T', true, get_color_code(COLOR_RED, COLOR_BLACK));
+}
+
+#define DEFAULT_BINDINGS \
+ { \
+ {KEY_UP, "", move_player, MOVE_UP}, \
+ {KEY_DOWN, "", move_player, MOVE_DOWN}, \
+ {KEY_LEFT, "", move_player, MOVE_LEFT}, \
+ {KEY_RIGHT, "", move_player, MOVE_RIGHT}, \
+ {'k', "", move_player, MOVE_UP}, \
+ {'j', "", move_player, MOVE_DOWN}, \
+ {'h', "", move_player, MOVE_LEFT}, \
+ {'l', "", move_player, MOVE_RIGHT}, \
+ {0, "kUP5", move_maze, MOVE_UP}, \
+ {0, "kDN5", move_maze, MOVE_DOWN}, \
+ {0, "kLFT5", move_maze, MOVE_LEFT}, \
+ {0, "kRIT5", move_maze, MOVE_RIGHT}, \
+ {0, "^K", move_maze, MOVE_UP}, \
+ {0, "^J", move_maze, MOVE_DOWN}, \
+ {0, "^H", move_maze, MOVE_LEFT}, \
+ {0, "^L", move_maze, MOVE_RIGHT}, \
+ {'0', "", move_maze, MOVE_BEGINNING}, \
+ {'p', "", turn_display_switch, DISP_PATH}, \
+ {'q', "", quit, GR_QUIT}, \
+ {'r', "", new_random, 0}, \
+ {'c', "", center, 0}, \
+ {'n', "", help_by_n_move, 1}, \
+ {'s', "", solve, 0}, \
+ {':', "", start_command_prompt, ':'}, \
+ }
+
+#endif \ No newline at end of file