BsScriptEditorInput.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 "Input/BsInputFwd.h"
  7. namespace bs
  8. {
  9. /** @addtogroup ScriptInteropEditor
  10. * @{
  11. */
  12. /** Interop class between C++ & CLR for Editor. */
  13. class BS_SCR_BED_EXPORT ScriptEditorInput : public ScriptObject<ScriptEditorInput>
  14. {
  15. public:
  16. SCRIPT_OBJ(EDITOR_ASSEMBLY, EDITOR_NS, "EditorInput")
  17. /** Registers internal callbacks. Must be called on scripting system load. */
  18. static void startUp();
  19. /** Unregisters internal callbacks. Must be called on scripting system shutdown. */
  20. static void shutDown();
  21. private:
  22. ScriptEditorInput(MonoObject* instance);
  23. /** Triggered when the specified button is pressed. */
  24. static void onButtonDown(const ButtonEvent& ev);
  25. /** Triggered when the specified button is released. */
  26. static void onButtonUp(const ButtonEvent& ev);
  27. /** Triggered when the specified character is entered. */
  28. static void onCharInput(const TextInputEvent& ev);
  29. /** Triggered when the pointer is moved. */
  30. static void onPointerMoved(const PointerEvent& ev);
  31. /** Triggered when a pointer button is pressed. */
  32. static void onPointerPressed(const PointerEvent& ev);
  33. /** Triggered when a pointer button is released. */
  34. static void onPointerReleased(const PointerEvent& ev);
  35. /** Triggered when a pointer button is double-clicked. */
  36. static void onPointerDoubleClick(const PointerEvent& ev);
  37. static HEvent OnButtonPressedConn;
  38. static HEvent OnButtonReleasedConn;
  39. static HEvent OnCharInputConn;
  40. static HEvent OnPointerPressedConn;
  41. static HEvent OnPointerReleasedConn;
  42. static HEvent OnPointerMovedConn;
  43. static HEvent OnPointerDoubleClickConn;
  44. /************************************************************************/
  45. /* CLR HOOKS */
  46. /************************************************************************/
  47. typedef void(BS_THUNKCALL *OnButtonEventThunkDef) (ButtonCode, UINT32, bool, MonoException**);
  48. typedef void(BS_THUNKCALL *OnCharInputEventThunkDef) (UINT32, bool, MonoException**);
  49. typedef void(BS_THUNKCALL *OnPointerEventThunkDef) (MonoObject*, MonoObject*, PointerEventButton,
  50. bool, bool, bool, float, bool, MonoException**);
  51. static OnButtonEventThunkDef OnButtonPressedThunk;
  52. static OnButtonEventThunkDef OnButtonReleasedThunk;
  53. static OnCharInputEventThunkDef OnCharInputThunk;
  54. static OnPointerEventThunkDef OnPointerPressedThunk;
  55. static OnPointerEventThunkDef OnPointerReleasedThunk;
  56. static OnPointerEventThunkDef OnPointerMovedThunk;
  57. static OnPointerEventThunkDef OnPointerDoubleClickThunk;
  58. };
  59. /** @} */
  60. }