You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
2.0 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /* Win32 screen routines header.
  2. Copyright (c) 2002 by Salvador E. Tropea (SET)
  3. Covered by the GPL license. */
  4. // This headers needs windows header
  5. #if defined(TVOS_Win32) && !defined(WIN32KEY_HEADER_INCLUDED)
  6. #define WIN32KEY_HEADER_INCLUDED
  7. struct TEvent;
  8. const unsigned eventKeyboardQSize=16;
  9. // A class to encapsulate the globals, all is static!
  10. class TGKeyWin32 : public TGKey
  11. {
  12. public:
  13. TGKeyWin32() {};
  14. // Function replacements
  15. //static void Suspend();
  16. //static void Resume();
  17. static int KbHit();
  18. //static void Clear();
  19. //static ushort GKey();
  20. static unsigned GetShiftState();
  21. static void FillTEvent(TEvent &e);
  22. //static void SetKbdMapping(int version);
  23. // Setup the pointers to point our members
  24. static void Init();
  25. static void DeInit();
  26. protected:
  27. // For this driver
  28. // Extract the shift state from the event (also used by the mouse class)
  29. static void ProcessControlKeyState(INPUT_RECORD *ir);
  30. // Translate Win32 shift state values to TV equivalents
  31. static ushort transShiftState(DWORD state);
  32. // Translate Win32 key events to TV equivalents
  33. static int transKeyEvent(KeyDownEvent &dst, KEY_EVENT_RECORD& src);
  34. // Add a key to the queue
  35. static void putConsoleKeyboardEvent(KeyDownEvent &key);
  36. // Remove a key event from the queue
  37. static int getConsoleKeyboardEvent(KeyDownEvent &key);
  38. // Process a Win32 key event and put it in the queue
  39. static void HandleKeyEvent();
  40. // Last value recieved for the shift modifiers
  41. static ushort LastControlKeyState;
  42. // Table used to Translate keyboard events
  43. static const char KeyTo[256];
  44. // Table for ASCII printable values
  45. static const char testChars[];
  46. // Queue
  47. static KeyDownEvent *evKeyboardIn;
  48. static KeyDownEvent *evKeyboardOut;
  49. static KeyDownEvent evKeyboardQueue[eventKeyboardQSize];
  50. static unsigned evKeyboardLength;
  51. static CRITICAL_SECTION lockKeyboard;
  52. friend class THWMouseWin32;
  53. friend class TScreenWin32;
  54. };
  55. #endif // WIN32KEY_HEADER_INCLUDED