Files
cc3k/src/curses_input.cc
Peisong Xiao c9e96b5e6e changed unique_ptr access to using raw pointers to denote non-ownership
added new flag -e for extra stuff (potions/races)
IMPORTANT: main.cc is undergoing rework
2024-07-12 09:58:30 -04:00

85 lines
1.9 KiB
C++

#include "curses_input.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;
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;
}