changed console key enum

This commit is contained in:
herbglitch 2024-07-23 22:55:23 -06:00
parent 80331b5c34
commit 95c93e5d10
2 changed files with 90 additions and 84 deletions

View file

@ -11,52 +11,54 @@ extern "C" {
typedef struct ARC_ConsoleKeyType ARC_ConsoleKey; typedef struct ARC_ConsoleKeyType ARC_ConsoleKey;
typedef enum ARC_ConsoleKey_Key { typedef enum ARC_ConsoleKey_Key {
ARC_KEY_A, ARC_CONSOLE_KEY_A,
ARC_KEY_B, ARC_CONSOLE_KEY_B,
ARC_KEY_C, ARC_CONSOLE_KEY_C,
ARC_KEY_D, ARC_CONSOLE_KEY_D,
ARC_KEY_E, ARC_CONSOLE_KEY_E,
ARC_KEY_F, ARC_CONSOLE_KEY_F,
ARC_KEY_G, ARC_CONSOLE_KEY_G,
ARC_KEY_H, ARC_CONSOLE_KEY_H,
ARC_KEY_I, ARC_CONSOLE_KEY_I,
ARC_KEY_J, ARC_CONSOLE_KEY_J,
ARC_KEY_K, ARC_CONSOLE_KEY_K,
ARC_KEY_L, ARC_CONSOLE_KEY_L,
ARC_KEY_M, ARC_CONSOLE_KEY_M,
ARC_KEY_N, ARC_CONSOLE_KEY_N,
ARC_KEY_O, ARC_CONSOLE_KEY_O,
ARC_KEY_P, ARC_CONSOLE_KEY_P,
ARC_KEY_Q, ARC_CONSOLE_KEY_Q,
ARC_KEY_R, ARC_CONSOLE_KEY_R,
ARC_KEY_S, ARC_CONSOLE_KEY_S,
ARC_KEY_T, ARC_CONSOLE_KEY_T,
ARC_KEY_U, ARC_CONSOLE_KEY_U,
ARC_KEY_V, ARC_CONSOLE_KEY_V,
ARC_KEY_W, ARC_CONSOLE_KEY_W,
ARC_KEY_X, ARC_CONSOLE_KEY_X,
ARC_KEY_Y, ARC_CONSOLE_KEY_Y,
ARC_KEY_Z, ARC_CONSOLE_KEY_Z,
ARC_KEY_0, ARC_CONSOLE_KEY_0,
ARC_KEY_1, ARC_CONSOLE_KEY_1,
ARC_KEY_2, ARC_CONSOLE_KEY_2,
ARC_KEY_3, ARC_CONSOLE_KEY_3,
ARC_KEY_4, ARC_CONSOLE_KEY_4,
ARC_KEY_5, ARC_CONSOLE_KEY_5,
ARC_KEY_6, ARC_CONSOLE_KEY_6,
ARC_KEY_7, ARC_CONSOLE_KEY_7,
ARC_KEY_8, ARC_CONSOLE_KEY_8,
ARC_KEY_9, ARC_CONSOLE_KEY_9,
ARC_KEY_LEFT, ARC_CONSOLE_KEY_LEFT,
ARC_KEY_RIGHT, ARC_CONSOLE_KEY_RIGHT,
ARC_KEY_DOWN, ARC_CONSOLE_KEY_DOWN,
ARC_KEY_UP, ARC_CONSOLE_KEY_UP,
ARC_KEY_BACKSPACE, ARC_CONSOLE_KEY_BACKSPACE,
ARC_KEY_ESC ARC_CONSOLE_KEY_ENTER,
ARC_CONSOLE_KEY_ESC
} ARC_ConsoleKey_Key; } ARC_ConsoleKey_Key;
void ARC_ConsoleKey_Create(ARC_ConsoleKey **consoleKey, ARC_ConsoleKey_Key *key); void ARC_ConsoleKey_Create(ARC_ConsoleKey **consoleKey, ARC_ConsoleKey_Key *key);

View file

@ -27,131 +27,135 @@ ARC_Bool ARC_ConsoleKey_EqualsPointer(ARC_ConsoleKey *consoleKey, ARC_ConsoleKey
ARC_ConsoleKey ARC_Keyboard_GetConsoleKey(enum ARC_ConsoleKey_Key key){ ARC_ConsoleKey ARC_Keyboard_GetConsoleKey(enum ARC_ConsoleKey_Key key){
switch(key){ switch(key){
case ARC_KEY_A: case ARC_CONSOLE_KEY_A:
return (ARC_ConsoleKey){ (int32_t)'a' }; return (ARC_ConsoleKey){ (int32_t)'a' };
case ARC_KEY_B: case ARC_CONSOLE_KEY_B:
return (ARC_ConsoleKey){ (int32_t)'b' }; return (ARC_ConsoleKey){ (int32_t)'b' };
case ARC_KEY_C: case ARC_CONSOLE_KEY_C:
return (ARC_ConsoleKey){ (int32_t)'c' }; return (ARC_ConsoleKey){ (int32_t)'c' };
case ARC_KEY_D: case ARC_CONSOLE_KEY_D:
return (ARC_ConsoleKey){ (int32_t)'d' }; return (ARC_ConsoleKey){ (int32_t)'d' };
case ARC_KEY_E: case ARC_CONSOLE_KEY_E:
return (ARC_ConsoleKey){ (int32_t)'e' }; return (ARC_ConsoleKey){ (int32_t)'e' };
case ARC_KEY_F: case ARC_CONSOLE_KEY_F:
return (ARC_ConsoleKey){ (int32_t)'f' }; return (ARC_ConsoleKey){ (int32_t)'f' };
case ARC_KEY_G: case ARC_CONSOLE_KEY_G:
return (ARC_ConsoleKey){ (int32_t)'g' }; return (ARC_ConsoleKey){ (int32_t)'g' };
case ARC_KEY_H: case ARC_CONSOLE_KEY_H:
return (ARC_ConsoleKey){ (int32_t)'h' }; return (ARC_ConsoleKey){ (int32_t)'h' };
case ARC_KEY_I: case ARC_CONSOLE_KEY_I:
return (ARC_ConsoleKey){ (int32_t)'i' }; return (ARC_ConsoleKey){ (int32_t)'i' };
case ARC_KEY_J: case ARC_CONSOLE_KEY_J:
return (ARC_ConsoleKey){ (int32_t)'j' }; return (ARC_ConsoleKey){ (int32_t)'j' };
case ARC_KEY_K: case ARC_CONSOLE_KEY_K:
return (ARC_ConsoleKey){ (int32_t)'k' }; return (ARC_ConsoleKey){ (int32_t)'k' };
case ARC_KEY_L: case ARC_CONSOLE_KEY_L:
return (ARC_ConsoleKey){ (int32_t)'l' }; return (ARC_ConsoleKey){ (int32_t)'l' };
case ARC_KEY_M: case ARC_CONSOLE_KEY_M:
return (ARC_ConsoleKey){ (int32_t)'m' }; return (ARC_ConsoleKey){ (int32_t)'m' };
case ARC_KEY_N: case ARC_CONSOLE_KEY_N:
return (ARC_ConsoleKey){ (int32_t)'n' }; return (ARC_ConsoleKey){ (int32_t)'n' };
case ARC_KEY_O: case ARC_CONSOLE_KEY_O:
return (ARC_ConsoleKey){ (int32_t)'o' }; return (ARC_ConsoleKey){ (int32_t)'o' };
case ARC_KEY_P: case ARC_CONSOLE_KEY_P:
return (ARC_ConsoleKey){ (int32_t)'p' }; return (ARC_ConsoleKey){ (int32_t)'p' };
case ARC_KEY_Q: case ARC_CONSOLE_KEY_Q:
return (ARC_ConsoleKey){ (int32_t)'q' }; return (ARC_ConsoleKey){ (int32_t)'q' };
case ARC_KEY_R: case ARC_CONSOLE_KEY_R:
return (ARC_ConsoleKey){ (int32_t)'r' }; return (ARC_ConsoleKey){ (int32_t)'r' };
case ARC_KEY_S: case ARC_CONSOLE_KEY_S:
return (ARC_ConsoleKey){ (int32_t)'s' }; return (ARC_ConsoleKey){ (int32_t)'s' };
case ARC_KEY_T: case ARC_CONSOLE_KEY_T:
return (ARC_ConsoleKey){ (int32_t)'t' }; return (ARC_ConsoleKey){ (int32_t)'t' };
case ARC_KEY_U: case ARC_CONSOLE_KEY_U:
return (ARC_ConsoleKey){ (int32_t)'u' }; return (ARC_ConsoleKey){ (int32_t)'u' };
case ARC_KEY_V: case ARC_CONSOLE_KEY_V:
return (ARC_ConsoleKey){ (int32_t)'v' }; return (ARC_ConsoleKey){ (int32_t)'v' };
case ARC_KEY_W: case ARC_CONSOLE_KEY_W:
return (ARC_ConsoleKey){ (int32_t)'w' }; return (ARC_ConsoleKey){ (int32_t)'w' };
case ARC_KEY_X: case ARC_CONSOLE_KEY_X:
return (ARC_ConsoleKey){ (int32_t)'x' }; return (ARC_ConsoleKey){ (int32_t)'x' };
case ARC_KEY_Y: case ARC_CONSOLE_KEY_Y:
return (ARC_ConsoleKey){ (int32_t)'y' }; return (ARC_ConsoleKey){ (int32_t)'y' };
case ARC_KEY_Z: case ARC_CONSOLE_KEY_Z:
return (ARC_ConsoleKey){ (int32_t)'z' }; return (ARC_ConsoleKey){ (int32_t)'z' };
case ARC_KEY_0: case ARC_CONSOLE_KEY_0:
return (ARC_ConsoleKey){ (int32_t)'0' }; return (ARC_ConsoleKey){ (int32_t)'0' };
case ARC_KEY_1: case ARC_CONSOLE_KEY_1:
return (ARC_ConsoleKey){ (int32_t)'1' }; return (ARC_ConsoleKey){ (int32_t)'1' };
case ARC_KEY_2: case ARC_CONSOLE_KEY_2:
return (ARC_ConsoleKey){ (int32_t)'2' }; return (ARC_ConsoleKey){ (int32_t)'2' };
case ARC_KEY_3: case ARC_CONSOLE_KEY_3:
return (ARC_ConsoleKey){ (int32_t)'3' }; return (ARC_ConsoleKey){ (int32_t)'3' };
case ARC_KEY_4: case ARC_CONSOLE_KEY_4:
return (ARC_ConsoleKey){ (int32_t)'4' }; return (ARC_ConsoleKey){ (int32_t)'4' };
case ARC_KEY_5: case ARC_CONSOLE_KEY_5:
return (ARC_ConsoleKey){ (int32_t)'5' }; return (ARC_ConsoleKey){ (int32_t)'5' };
case ARC_KEY_6: case ARC_CONSOLE_KEY_6:
return (ARC_ConsoleKey){ (int32_t)'6' }; return (ARC_ConsoleKey){ (int32_t)'6' };
case ARC_KEY_7: case ARC_CONSOLE_KEY_7:
return (ARC_ConsoleKey){ (int32_t)'7' }; return (ARC_ConsoleKey){ (int32_t)'7' };
case ARC_KEY_8: case ARC_CONSOLE_KEY_8:
return (ARC_ConsoleKey){ (int32_t)'8' }; return (ARC_ConsoleKey){ (int32_t)'8' };
case ARC_KEY_9: case ARC_CONSOLE_KEY_9:
return (ARC_ConsoleKey){ (int32_t)'9' }; return (ARC_ConsoleKey){ (int32_t)'9' };
case ARC_KEY_UP: case ARC_CONSOLE_KEY_UP:
return (ARC_ConsoleKey){ KEY_UP }; return (ARC_ConsoleKey){ KEY_UP };
case ARC_KEY_DOWN: case ARC_CONSOLE_KEY_DOWN:
return (ARC_ConsoleKey){ KEY_DOWN }; return (ARC_ConsoleKey){ KEY_DOWN };
case ARC_KEY_LEFT: case ARC_CONSOLE_KEY_LEFT:
return (ARC_ConsoleKey){ KEY_LEFT }; return (ARC_ConsoleKey){ KEY_LEFT };
case ARC_KEY_RIGHT: case ARC_CONSOLE_KEY_RIGHT:
return (ARC_ConsoleKey){ KEY_RIGHT }; return (ARC_ConsoleKey){ KEY_RIGHT };
case ARC_KEY_BACKSPACE: case ARC_CONSOLE_KEY_BACKSPACE:
return (ARC_ConsoleKey){ KEY_BACKSPACE }; return (ARC_ConsoleKey){ KEY_BACKSPACE };
//TODO: This should probs be KEY_ENTER, but idk why it wasn't working
case ARC_CONSOLE_KEY_ENTER:
return (ARC_ConsoleKey){ 10 };
//TODO: This is escape and alt, need to fix //TODO: This is escape and alt, need to fix
case ARC_KEY_ESC: case ARC_CONSOLE_KEY_ESC:
return (ARC_ConsoleKey){ 27 }; return (ARC_ConsoleKey){ 27 };
default: default: