BsScriptEditorInput.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #pragma once
  2. #include "BsScriptEditorPrerequisites.h"
  3. #include "BsScriptObject.h"
  4. #include "BsInputFwd.h"
  5. namespace BansheeEngine
  6. {
  7. /**
  8. * @brief Interop class between C++ & CLR for Editor.
  9. */
  10. class BS_SCR_BED_EXPORT ScriptEditorInput : public ScriptObject<ScriptEditorInput>
  11. {
  12. public:
  13. SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "EditorInput")
  14. /**
  15. * @brief Registers internal callbacks. Must be called on scripting system load.
  16. */
  17. static void startUp();
  18. /**
  19. * @brief Unregisters internal callbacks. Must be called on scripting system shutdown.
  20. */
  21. static void shutDown();
  22. private:
  23. ScriptEditorInput(MonoObject* instance);
  24. /**
  25. * @brief Triggered when the specified button is pressed.
  26. */
  27. static void onButtonDown(const ButtonEvent& ev);
  28. /**
  29. * @brief Triggered when the specified button is released.
  30. */
  31. static void onButtonUp(const ButtonEvent& ev);
  32. /**
  33. * @brief Triggered when the specified character is entered.
  34. */
  35. static void onCharInput(const TextInputEvent& ev);
  36. /**
  37. * @brief Triggered when the pointer is moved.
  38. */
  39. static void onPointerMoved(const PointerEvent& ev);
  40. /**
  41. * @brief Triggered when a pointer button is pressed.
  42. */
  43. static void onPointerPressed(const PointerEvent& ev);
  44. /**
  45. * @brief Triggered when a pointer button is released.
  46. */
  47. static void onPointerReleased(const PointerEvent& ev);
  48. /**
  49. * @brief Triggered when a pointer button is double-clicked.
  50. */
  51. static void onPointerDoubleClick(const PointerEvent& ev);
  52. static HEvent OnButtonPressedConn;
  53. static HEvent OnButtonReleasedConn;
  54. static HEvent OnCharInputConn;
  55. static HEvent OnPointerPressedConn;
  56. static HEvent OnPointerReleasedConn;
  57. static HEvent OnPointerMovedConn;
  58. static HEvent OnPointerDoubleClickConn;
  59. /************************************************************************/
  60. /* CLR HOOKS */
  61. /************************************************************************/
  62. typedef void(__stdcall *OnButtonEventThunkDef) (ButtonCode, UINT32, MonoException**);
  63. typedef void(__stdcall *OnCharInputEventThunkDef) (UINT32, MonoException**);
  64. typedef void(__stdcall *OnPointerEventThunkDef) (MonoObject*, MonoObject*, PointerEventButton,
  65. bool, bool, bool, float, MonoException**);
  66. static OnButtonEventThunkDef OnButtonPressedThunk;
  67. static OnButtonEventThunkDef OnButtonReleasedThunk;
  68. static OnCharInputEventThunkDef OnCharInputThunk;
  69. static OnPointerEventThunkDef OnPointerPressedThunk;
  70. static OnPointerEventThunkDef OnPointerReleasedThunk;
  71. static OnPointerEventThunkDef OnPointerMovedThunk;
  72. static OnPointerEventThunkDef OnPointerDoubleClickThunk;
  73. };
  74. }