finished the bulk of game

This commit is contained in:
2024-07-14 21:32:41 -04:00
parent b3475b7530
commit af8bc4112c
110 changed files with 1876 additions and 1481 deletions

89
src/input/curses_input.cc Normal file
View File

@ -0,0 +1,89 @@
#include "curses_input.h"
#include "../constants.h"
curses_input::curses_input(cursor *new_curse):
curse{new_curse} {}
game_command curses_input::get_command() {
switch (curse->getcmd()) {
case 'h':
return game_command::move_west;
case 'j':
return game_command::move_south;
case 'k':
return game_command::move_north;
case 'l':
return game_command::move_east;
case 'y':
return game_command::move_northwest;
case 'u':
return game_command::move_northeast;
case 'b':
return game_command::move_southwest;
case 'n':
return game_command::move_southeast;
case 'a':
break; // wait for another command
case '<':
return game_command::up_stairs;
case '>':
return game_command::down_stairs;
case 'q':
return game_command_terminate;
case 'f':
return game_command::the_world;
case 'r':
return game_restart;
case KEY_ENTER:
return game_command::enter;
default:
return game_command_pass;
}
switch (curse->getcmd()) {
case 'h':
return game_command::apply_west;
case 'j':
return game_command::apply_south;
case 'k':
return game_command::apply_north;
case 'l':
return game_command::apply_east;
case 'y':
return game_command::apply_northwest;
case 'u':
return game_command::apply_northeast;
case 'b':
return game_command::apply_southwest;
case 'n':
return game_command::apply_southeast;
default:
return game_command::apply_panic;
}
return game_command::game_command_panic;
}