module; #include export module Input; export class KeyBoard { static bool LastKeyStatus[256]; static bool CurrKeyStatus[256]; public: static void OnKeyMsg(char keycode, bool status) { CurrKeyStatus[keycode] = status; } static bool GetKey(char keycode) { return CurrKeyStatus[keycode]; } static bool GetKeyUp(char keycode) { return LastKeyStatus[keycode] && !CurrKeyStatus[keycode]; } static bool GetKeyDown(char keycode) { return !LastKeyStatus[keycode] && CurrKeyStatus[keycode]; } static void Flush() { memcpy(LastKeyStatus, CurrKeyStatus, sizeof(CurrKeyStatus)); } }; bool KeyBoard::LastKeyStatus[256]{}; bool KeyBoard::CurrKeyStatus[256]{};