Cleaned Up AppPlatform & Input Classes

* Cleaned up AppPlatform classes
* Documented & improved Keyboard & Mouse classes
* Improved input-handling code in the Windows & SDL main.cpp files
This commit is contained in:
Brent Da Mage
2023-08-19 06:26:50 -05:00
committed by iProgramInCpp
parent e731fefbea
commit d5ee7bfc08
21 changed files with 422 additions and 375 deletions

View File

@@ -16,22 +16,18 @@
#define KEYBOARD_STATES_SIZE 256
struct KeyboardAction
{
int field_0;
uint8_t field_4;
KeyboardAction(uint8_t key, int state)
{
field_0 = state;
field_4 = key;
}
};
struct KeyboardAction;
class Keyboard
{
public:
static void feed(int down, int key);
enum KeyState : bool
{
UP,
DOWN
};
static void feed(KeyState state, int key);
static bool next();
static int getEventKey();
static int getEventKeyState();
@@ -40,7 +36,18 @@ public:
private:
static std::vector<KeyboardAction> _inputs;
static int _states[KEYBOARD_STATES_SIZE];
static Keyboard::KeyState _states[KEYBOARD_STATES_SIZE];
static int _index;
};
struct KeyboardAction
{
int _keyState;
uint8_t _keyCode;
KeyboardAction(uint8_t keyCode, Keyboard::KeyState keyState)
{
_keyState = keyState;
_keyCode = keyCode;
}
};