BsScriptInput.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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(BansheeEngineAssemblyName, "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 float internal_getAxisValue(UINT32 axisType, UINT32 deviceIdx);
  25. static void internal_getPointerPosition(Vector2I* position);
  26. static void internal_getPointerDelta(Vector2I* position);
  27. typedef void(__stdcall *OnButtonEventThunkDef) (ButtonCode, UINT32, MonoException**);
  28. typedef void(__stdcall *OnCharInputEventThunkDef) (UINT32, MonoException**);
  29. typedef void(__stdcall *OnPointerEventThunkDef) (MonoObject*, MonoObject*, PointerEventButton,
  30. bool, bool, bool, float, MonoException**);
  31. static OnButtonEventThunkDef OnButtonPressedThunk;
  32. static OnButtonEventThunkDef OnButtonReleasedThunk;
  33. static OnCharInputEventThunkDef OnCharInputThunk;
  34. static OnPointerEventThunkDef OnPointerPressedThunk;
  35. static OnPointerEventThunkDef OnPointerReleasedThunk;
  36. static OnPointerEventThunkDef OnPointerMovedThunk;
  37. static OnPointerEventThunkDef OnPointerDoubleClickThunk;
  38. static HEvent OnButtonPressedConn;
  39. static HEvent OnButtonReleasedConn;
  40. static HEvent OnCharInputConn;
  41. static HEvent OnPointerPressedConn;
  42. static HEvent OnPointerReleasedConn;
  43. static HEvent OnPointerMovedConn;
  44. static HEvent OnPointerDoubleClickConn;
  45. ScriptInput(MonoObject* instance);
  46. };
  47. }