InputState.h 994 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #pragma once
  2. #include "JvsButtons.h"
  3. #include "InputBufferType.h"
  4. namespace TLAC::Components
  5. {
  6. const int MAX_BUTTON_BIT = 0x6F;
  7. // The button state is larger than the size of a register
  8. // but only the first 32 bits are used during normal gameplay
  9. // so this will provide the convenience of still being able to access them through a bit field
  10. union ButtonState
  11. {
  12. JvsButtons Buttons;
  13. uint32_t State[4];
  14. };
  15. // total sizeof() == 0x20E0
  16. struct InputState
  17. {
  18. ButtonState Tapped;
  19. ButtonState Released;
  20. ButtonState Down;
  21. uint32_t Padding_20[4];
  22. ButtonState DoubleTapped;
  23. uint32_t Padding_30[4];
  24. ButtonState IntervalTapped;
  25. uint32_t Padding_38[12];
  26. int32_t MouseX;
  27. int32_t MouseY;
  28. int32_t MouseDeltaX;
  29. int32_t MouseDeltaY;
  30. uint32_t Padding_AC[8];
  31. uint8_t Padding_D0[3];
  32. char Key;
  33. void ClearState();
  34. void HideCursor();
  35. void SetBit(uint32_t bit, bool value, InputBufferType inputType);
  36. uint8_t* GetInputBuffer(InputBufferType inputType);
  37. };
  38. }