BsScriptInput.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #pragma once
  2. #include "BsScriptEnginePrerequisites.h"
  3. #include "BsScriptObject.h"
  4. #include "BsInputFwd.h"
  5. namespace BansheeEngine
  6. {
  7. class BS_SCR_BE_EXPORT ScriptInput : public ScriptObject<ScriptInput>
  8. {
  9. public:
  10. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "Input")
  11. static void startUp();
  12. static void shutDown();
  13. private:
  14. static void onButtonDown(const ButtonEvent& ev);
  15. static void onButtonUp(const ButtonEvent& ev);
  16. static void onCharInput(const TextInputEvent& ev);
  17. static void onPointerMoved(const PointerEvent& ev);
  18. static void onPointerPressed(const PointerEvent& ev);
  19. static void onPointerReleased(const PointerEvent& ev);
  20. static void onPointerDoubleClick(const PointerEvent& ev);
  21. static bool internal_isButtonHeld(ButtonCode code, UINT32 deviceIdx);
  22. static bool internal_isButtonDown(ButtonCode code, UINT32 deviceIdx);
  23. static bool internal_isButtonUp(ButtonCode code, UINT32 deviceIdx);
  24. static bool internal_isPointerButtonHeld(PointerEventButton code);
  25. static bool internal_isPointerButtonDown(PointerEventButton code);
  26. static bool internal_isPointerButtonUp(PointerEventButton code);
  27. static bool internal_isPointerDoubleClicked();
  28. static float internal_getAxisValue(UINT32 axisType, UINT32 deviceIdx);
  29. static void internal_getPointerPosition(Vector2I* position);
  30. static void internal_getPointerDelta(Vector2I* position);
  31. typedef void(__stdcall *OnButtonEventThunkDef) (ButtonCode, UINT32, MonoException**);
  32. typedef void(__stdcall *OnCharInputEventThunkDef) (UINT32, MonoException**);
  33. typedef void(__stdcall *OnPointerEventThunkDef) (MonoObject*, MonoObject*, PointerEventButton,
  34. bool, bool, bool, float, MonoException**);
  35. static OnButtonEventThunkDef OnButtonPressedThunk;
  36. static OnButtonEventThunkDef OnButtonReleasedThunk;
  37. static OnCharInputEventThunkDef OnCharInputThunk;
  38. static OnPointerEventThunkDef OnPointerPressedThunk;
  39. static OnPointerEventThunkDef OnPointerReleasedThunk;
  40. static OnPointerEventThunkDef OnPointerMovedThunk;
  41. static OnPointerEventThunkDef OnPointerDoubleClickThunk;
  42. static HEvent OnButtonPressedConn;
  43. static HEvent OnButtonReleasedConn;
  44. static HEvent OnCharInputConn;
  45. static HEvent OnPointerPressedConn;
  46. static HEvent OnPointerReleasedConn;
  47. static HEvent OnPointerMovedConn;
  48. static HEvent OnPointerDoubleClickConn;
  49. ScriptInput(MonoObject* instance);
  50. };
  51. }