Input.pkg 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. $#include "Input.h"
  2. struct TouchState
  3. {
  4. int touchID_ @ touchID;
  5. IntVector2 position_ @ position;
  6. IntVector2 lastPosition_ @ lastPosition;
  7. IntVector2 delta_ @ delta;
  8. float pressure_ @ pressure;
  9. };
  10. struct JoystickState
  11. {
  12. unsigned GetNumButtons() const;
  13. unsigned GetNumAxes() const;
  14. unsigned GetNumHats() const;
  15. bool GetButtonDown(unsigned index) const;
  16. bool GetButtonPress(unsigned index) const;
  17. float GetAxisPosition(unsigned index) const;
  18. int GetHatPosition(unsigned index) const;
  19. tolua_readonly tolua_property__get_set unsigned numButtons;
  20. tolua_readonly tolua_property__get_set unsigned numAxes;
  21. tolua_readonly tolua_property__get_set unsigned numHats;
  22. };
  23. class Input : public Object
  24. {
  25. void SetToggleFullscreen(bool enable);
  26. void SetMouseVisible(bool enable);
  27. bool OpenJoystick(unsigned index);
  28. void CloseJoystick(unsigned index);
  29. bool DetectJoysticks();
  30. void SetScreenKeyboardVisible(bool enable);
  31. int GetKeyFromName(const String name) const;
  32. int GetKeyFromScancode(int scancode) const;
  33. String GetKeyName(int key) const;
  34. int GetScancodeFromKey(int key) const;
  35. int GetScancodeFromName(const String name) const;
  36. String GetScancodeName(int scancode) const;
  37. bool GetKeyDown(int key) const;
  38. bool GetKeyPress(int key) const;
  39. bool GetScancodeDown(int scancode) const;
  40. bool GetScancodePress(int scancode) const;
  41. bool GetMouseButtonDown(int button) const;
  42. bool GetMouseButtonPress(int button) const;
  43. bool GetQualifierDown(int qualifier) const;
  44. bool GetQualifierPress(int qualifier) const;
  45. int GetQualifiers() const;
  46. IntVector2 GetMousePosition() const;
  47. const IntVector2& GetMouseMove() const;
  48. int GetMouseMoveX() const;
  49. int GetMouseMoveY() const;
  50. int GetMouseMoveWheel() const;
  51. unsigned GetNumTouches() const;
  52. TouchState* GetTouch(unsigned index) const;
  53. unsigned GetNumJoysticks() const;
  54. const String GetJoystickName(unsigned index) const;
  55. JoystickState* GetJoystick(unsigned index);
  56. bool GetToggleFullscreen() const;
  57. bool GetScreenKeyboardSupport() const;
  58. bool IsScreenKeyboardVisible() const;
  59. bool IsMouseVisible() const;
  60. bool HasFocus();
  61. bool IsMinimized() const;
  62. tolua_readonly tolua_property__get_set int qualifiers;
  63. tolua_readonly tolua_property__get_set IntVector2 mousePosition;
  64. tolua_readonly tolua_property__get_set IntVector2& mouseMove;
  65. tolua_readonly tolua_property__get_set int mouseMoveX;
  66. tolua_readonly tolua_property__get_set int mouseMoveY;
  67. tolua_readonly tolua_property__get_set int mouseMoveWheel;
  68. tolua_readonly tolua_property__get_set unsigned numTouches;
  69. tolua_readonly tolua_property__get_set unsigned numJoysticks;
  70. tolua_readonly tolua_property__get_set bool toggleFullscreen;
  71. tolua_readonly tolua_property__get_set bool screenKeyboardSupport;
  72. tolua_property__is_set bool screenKeyboardVisible;
  73. tolua_property__is_set bool mouseVisible;
  74. tolua_readonly tolua_property__has_set bool focus;
  75. tolua_readonly tolua_property__is_set bool minimized;
  76. };
  77. Input* GetInput();
  78. tolua_readonly tolua_property__get_set Input* input;
  79. ${
  80. #define TOLUA_DISABLE_tolua_InputLuaAPI_GetInput00
  81. static int tolua_InputLuaAPI_GetInput00(lua_State* tolua_S)
  82. {
  83. return ToluaGetSubsystem<Input>(tolua_S);
  84. }
  85. #define TOLUA_DISABLE_tolua_get_input_ptr
  86. #define tolua_get_input_ptr tolua_InputLuaAPI_GetInput00
  87. $}