XBoxKeyboard.cpp 797 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifdef _XBOX
  2. #include "XBoxKeyboard.h"
  3. #include "pc.h"
  4. #include <xtl.h>
  5. XBoxKeyboard::XBoxKeyboard(Controls& ctrlSrv):
  6. m_Controls(__FILE__, __LINE__),
  7. m_ControlsService(ctrlSrv)
  8. {
  9. }
  10. void XBoxKeyboard::Update(float DeltaTime)
  11. {
  12. m_ControlsService.ClearKeyBuffer();
  13. for (;;)
  14. {
  15. XINPUT_KEYSTROKE xKey;
  16. DWORD result = XInputGetKeystroke(0, XINPUT_FLAG_KEYBOARD, &xKey);
  17. if (result != ERROR_SUCCESS)
  18. {
  19. return;
  20. }
  21. KeyDescr key;
  22. if (xKey.Unicode)
  23. {
  24. key.bSystem = false;
  25. key.ucVKey = xKey.Unicode;
  26. }
  27. else
  28. {
  29. key.bSystem = true;
  30. key.ucVKey = xKey.VirtualKey;
  31. }
  32. m_ControlsService.AddKey(key);
  33. }
  34. }
  35. long XBoxKeyboard::GetIndex(const char* deviceControl)
  36. {
  37. return INVALID_CODE;
  38. }
  39. float XBoxKeyboard::GetRawValue(long controlIndex) const
  40. {
  41. return 0;
  42. }
  43. #endif