added: input and its subclasses

This commit is contained in:
2024-07-04 22:47:25 -04:00
parent c67dbcc62a
commit f5b5f180a0
9 changed files with 245 additions and 18 deletions

View File

@ -6,8 +6,7 @@
#include <vector>
#include "position.h"
// IMPORTANT: added END to the end of all valued enums so that you can
// iterate over them
// IMPORTANT: panic is reserved for invalid results
enum error {none};
@ -16,6 +15,21 @@ enum result {fine, died, go_down, hit, moved};
enum game_status {terminated, main_menu, in_game, options};
enum game_command {game_command_terminate = 0,
move_north, move_south, move_east, move_west,
move_northeast, move_northwest,
move_southeast, move_southwest,
apply_north, apply_south, apply_east, apply_west,
apply_northeast, apply_northwest,
apply_southeast, apply_southwest,
apply_prompt, apply_panic, // for curses_input specifically
attack_north, attack_south, attack_east, attack_west,
attack_northeast, attack_northwest,
attack_southeast, attack_southwest,
up_stairs, down_stairs,
game_command_pass, game_command_panic
};
enum stat_name {HP, ATK, DEF, hostile};
const int LAYER_CNT = 4; // TODO: update as you go
@ -35,12 +49,12 @@ const char CHARACTER_REP[RACE_CNT] = {'@', 'S'};
const int DIRECTION_CNT = 8;
// IMPORTANT: east is positive for x and SOUTH is positive for y
// initializes all directions to an int
enum direction {east = 0, west, north, south, northeast,
northwest, southeast, southest
enum direction { north = 0, south, east, west, northeast,
northwest, southeast, southest
};
const position MOVE[DIRECTION_CNT] = {
{1, 0}, {-1, 0}, {0, -1}, {0, 1},
{0, -1}, {0, 1}, {1, 0}, {-1, 0},
{1, -1}, {-1, -1}, {1, 1}, {-1, 1}
};