Input.pkg 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. bool GetKeyDown(int key) const;
  32. bool GetKeyPress(int key) const;
  33. bool GetMouseButtonDown(int button) const;
  34. bool GetMouseButtonPress(int button) const;
  35. bool GetQualifierDown(int qualifier) const;
  36. bool GetQualifierPress(int qualifier) const;
  37. int GetQualifiers() const;
  38. IntVector2 GetMousePosition() const;
  39. const IntVector2& GetMouseMove() const;
  40. int GetMouseMoveX() const;
  41. int GetMouseMoveY() const;
  42. int GetMouseMoveWheel() const;
  43. unsigned GetNumTouches() const;
  44. TouchState* GetTouch(unsigned index) const;
  45. unsigned GetNumJoysticks() const;
  46. const String GetJoystickName(unsigned index) const;
  47. JoystickState* GetJoystick(unsigned index);
  48. bool GetToggleFullscreen() const;
  49. bool GetScreenKeyboardSupport() const;
  50. bool IsScreenKeyboardVisible() const;
  51. bool IsMouseVisible() const;
  52. bool HasFocus();
  53. bool IsMinimized() const;
  54. tolua_readonly tolua_property__get_set int qualifiers;
  55. tolua_readonly tolua_property__get_set IntVector2 mousePosition;
  56. tolua_readonly tolua_property__get_set IntVector2& mouseMove;
  57. tolua_readonly tolua_property__get_set int mouseMoveX;
  58. tolua_readonly tolua_property__get_set int mouseMoveY;
  59. tolua_readonly tolua_property__get_set int mouseMoveWheel;
  60. tolua_readonly tolua_property__get_set unsigned numTouches;
  61. tolua_readonly tolua_property__get_set unsigned numJoysticks;
  62. tolua_readonly tolua_property__get_set bool toggleFullscreen;
  63. tolua_readonly tolua_property__get_set bool screenKeyboardSupport;
  64. tolua_property__is_set bool screenKeyboardVisible;
  65. tolua_property__is_set bool mouseVisible;
  66. tolua_readonly tolua_property__has_set bool focus;
  67. tolua_readonly tolua_property__is_set bool minimized;
  68. };
  69. Input* GetInput();
  70. tolua_readonly tolua_property__get_set Input* input;
  71. ${
  72. #define TOLUA_DISABLE_tolua_InputLuaAPI_GetInput00
  73. static int tolua_InputLuaAPI_GetInput00(lua_State* tolua_S)
  74. {
  75. return ToluaGetSubsystem<Input>(tolua_S);
  76. }
  77. #define TOLUA_DISABLE_tolua_get_input_ptr
  78. #define tolua_get_input_ptr tolua_InputLuaAPI_GetInput00
  79. $}