InputSourceKeyboard.h 895 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * InputSourceKeyboard.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. struct SDL_KeyboardEvent;
  12. /// Class that handles keyboard input from SDL events
  13. class InputSourceKeyboard
  14. {
  15. bool wasKeyboardCtrlDown;
  16. bool wasKeyboardAltDown;
  17. bool wasKeyboardShiftDown;
  18. bool handleBackRightMouseButton; // on some android devices right mouse button is "back"
  19. std::string getKeyNameWithModifiers(const std::string & keyName, bool keyUp);
  20. public:
  21. InputSourceKeyboard();
  22. void handleEventKeyDown(const SDL_KeyboardEvent & current);
  23. void handleEventKeyUp(const SDL_KeyboardEvent & current);
  24. bool isKeyboardAltDown() const;
  25. bool isKeyboardCmdDown() const;
  26. bool isKeyboardCtrlDown() const;
  27. bool isKeyboardShiftDown() const;
  28. };