finished the bulk of game
This commit is contained in:
89
src/input/curses_input.cc
Normal file
89
src/input/curses_input.cc
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user