BsScriptInput.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. typedef void(__stdcall *OnButtonEventThunkDef) (ButtonCode, UINT32, MonoException**);
  27. typedef void(__stdcall *OnCharInputEventThunkDef) (UINT32, MonoException**);
  28. typedef void(__stdcall *OnPointerEventThunkDef) (MonoObject*, PointerEventButton,
  29. bool, bool, bool, float, MonoException**);
  30. static OnButtonEventThunkDef OnButtonPressedThunk;
  31. static OnButtonEventThunkDef OnButtonReleasedThunk;
  32. static OnCharInputEventThunkDef OnCharInputThunk;
  33. static OnPointerEventThunkDef OnPointerPressedThunk;
  34. static OnPointerEventThunkDef OnPointerReleasedThunk;
  35. static OnPointerEventThunkDef OnPointerMovedThunk;
  36. static OnPointerEventThunkDef OnPointerDoubleClickThunk;
  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. ScriptInput(MonoObject* instance);
  45. };
  46. }