#ifndef PKE_PLAYER_INPUT_HPP #define PKE_PLAYER_INPUT_HPP #include "dynamic-array.hpp" #include "game-type-defs.hpp" #include "macros.hpp" TypeSafeInt_H(InputEventHash, int16_t, 0x0FFF); TypeSafeInt_H(InputEventType, int16_t, 0x0FFF); TypeSafeInt_H(InputCursorEntered, int16_t, 0x0FFF); TypeSafeInt_H(InputKeyboardKeyAction, int16_t, 0x0FFF); TypeSafeInt_H(InputMouseButtonAction, int16_t, 0x0FFF); TypeSafeInt_H(InputWindowFocused, int16_t, 0x0FFF); const InputEventType PKE_INPUT_EVENT_TYPE_CURSOR_ENTER = InputEventType{0}; const InputEventType PKE_INPUT_EVENT_TYPE_CURSOR_POS = InputEventType{1}; const InputEventType PKE_INPUT_EVENT_TYPE_KEY = InputEventType{2}; const InputEventType PKE_INPUT_EVENT_TYPE_MOUSE_BUTTON = InputEventType{3}; const InputEventType PKE_INPUT_EVENT_TYPE_SCROLL = InputEventType{4}; const InputEventType PKE_INPUT_EVENT_TYPE_WINDOW_FOCUS = InputEventType{5}; const InputCursorEntered PKE_INPUT_CURSOR_ENTERED_UNSET = InputCursorEntered{-1}; const InputCursorEntered PKE_INPUT_CURSOR_ENTERED_FALSE = InputCursorEntered{0}; const InputCursorEntered PKE_INPUT_CURSOR_ENTERED_TRUE = InputCursorEntered{1}; const InputKeyboardKeyAction PKE_INPUT_KEYBOARD_KEY_ACTION_UNSET = InputKeyboardKeyAction{-1}; const InputKeyboardKeyAction PKE_INPUT_KEYBOARD_KEY_ACTION_RELEASE = InputKeyboardKeyAction{0}; const InputKeyboardKeyAction PKE_INPUT_KEYBOARD_KEY_ACTION_PRESS = InputKeyboardKeyAction{1}; const InputKeyboardKeyAction PKE_INPUT_KEYBOARD_KEY_ACTION_REPEAT = InputKeyboardKeyAction{2}; const InputMouseButtonAction PKE_INPUT_MOUSE_BUTTON_ACTION_UNSET = InputMouseButtonAction{-1}; const InputMouseButtonAction PKE_INPUT_MOUSE_BUTTON_ACTION_RELEASE = InputMouseButtonAction{0}; const InputMouseButtonAction PKE_INPUT_MOUSE_BUTTON_ACTION_PRESS = InputMouseButtonAction{1}; const InputWindowFocused PKE_INPUT_WINDOW_FOCUSED_UNSET = InputWindowFocused{-1}; const InputWindowFocused PKE_INPUT_WINDOW_FOCUSED_FALSE = InputWindowFocused{0}; const InputWindowFocused PKE_INPUT_WINDOW_FOCUSED_TRUE = InputWindowFocused{1}; struct PkeInputEvent { InputEventType type; GameTimePoint timePoint; InputCursorEntered cursorEntered; InputKeyboardKeyAction keyboardKeyAction; InputMouseButtonAction mouseButtonAction; InputWindowFocused windowFocused; double x; double y; int32_t button; int32_t scanCode; int32_t mods; uint64_t tickCount; }; void PkeInput_Tick(double delta); bool PkeInput_Query(const PkeInputEvent &mask); void PkeInput_Init(); void PkeInput_Teardown(); #endif /* PKE_PLAYER_INPUT_HPP */