2
0

BsScriptEditorInput.h 2.9 KB

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