Expose some Input class delegates to scripting API

This commit is contained in:
Withaust
2023-06-08 01:24:38 +03:00
parent 2c809389ad
commit 8c0c6c0142
2 changed files with 23 additions and 29 deletions

View File

@@ -85,18 +85,18 @@ Keyboard* Input::Keyboard = nullptr;
Array<Gamepad*, FixedAllocation<MAX_GAMEPADS>> Input::Gamepads;
Action Input::GamepadsChanged;
Array<InputDevice*, InlinedAllocation<16>> Input::CustomDevices;
Input::CharDelegate Input::CharInput;
Input::KeyboardDelegate Input::KeyDown;
Input::KeyboardDelegate Input::KeyUp;
Input::MouseButtonDelegate Input::MouseDown;
Input::MouseButtonDelegate Input::MouseUp;
Input::MouseButtonDelegate Input::MouseDoubleClick;
Input::MouseWheelDelegate Input::MouseWheel;
Input::MouseDelegate Input::MouseMove;
Delegate<Char> Input::CharInput;
Delegate<KeyboardKeys> Input::KeyDown;
Delegate<KeyboardKeys> Input::KeyUp;
Delegate<const Float2&, MouseButton> Input::MouseDown;
Delegate<const Float2&, MouseButton> Input::MouseUp;
Delegate<const Float2&, MouseButton> Input::MouseDoubleClick;
Delegate<const Float2&, float> Input::MouseWheel;
Delegate<const Float2&> Input::MouseMove;
Action Input::MouseLeave;
Input::TouchDelegate Input::TouchDown;
Input::TouchDelegate Input::TouchMove;
Input::TouchDelegate Input::TouchUp;
Delegate<const Float2&, int32> Input::TouchDown;
Delegate<const Float2&, int32> Input::TouchMove;
Delegate<const Float2&, int32> Input::TouchUp;
Delegate<StringView> Input::ActionTriggered;
Array<ActionConfig> Input::ActionMappings;
Array<AxisConfig> Input::AxisMappings;

View File

@@ -66,72 +66,66 @@ API_CLASS(Static) class FLAXENGINE_API Input
static Array<InputDevice*, InlinedAllocation<16>> CustomDevices;
public:
typedef Delegate<Char> CharDelegate;
typedef Delegate<KeyboardKeys> KeyboardDelegate;
typedef Delegate<const Float2&> MouseDelegate;
typedef Delegate<const Float2&, MouseButton> MouseButtonDelegate;
typedef Delegate<const Float2&, float> MouseWheelDelegate;
typedef Delegate<const Float2&, int32> TouchDelegate;
/// <summary>
/// Event fired on character input.
/// </summary>
static CharDelegate CharInput;
API_EVENT() static Delegate<Char> CharInput;
/// <summary>
/// Event fired on key pressed.
/// </summary>
static KeyboardDelegate KeyDown;
API_EVENT() static Delegate<KeyboardKeys> KeyDown;
/// <summary>
/// Event fired on key released.
/// </summary>
static KeyboardDelegate KeyUp;
API_EVENT() static Delegate<KeyboardKeys> KeyUp;
/// <summary>
/// Event fired when mouse button goes down.
/// </summary>
static MouseButtonDelegate MouseDown;
API_EVENT() static Delegate<const Float2&, MouseButton> MouseDown;
/// <summary>
/// Event fired when mouse button goes up.
/// </summary>
static MouseButtonDelegate MouseUp;
API_EVENT() static Delegate<const Float2&, MouseButton> MouseUp;
/// <summary>
/// Event fired when mouse button double clicks.
/// </summary>
static MouseButtonDelegate MouseDoubleClick;
API_EVENT() static Delegate<const Float2&, MouseButton> MouseDoubleClick;
/// <summary>
/// Event fired when mouse wheel is scrolling (wheel delta is normalized).
/// </summary>
static MouseWheelDelegate MouseWheel;
API_EVENT() static Delegate<const Float2&, float> MouseWheel;
/// <summary>
/// Event fired when mouse moves.
/// </summary>
static MouseDelegate MouseMove;
API_EVENT() static Delegate<const Float2&> MouseMove;
/// <summary>
/// Event fired when mouse leaves window.
/// </summary>
static Action MouseLeave;
API_EVENT() static Action MouseLeave;
/// <summary>
/// Event fired when touch action begins.
/// </summary>
static TouchDelegate TouchDown;
API_EVENT() static Delegate<const Float2&, int32> TouchDown;
/// <summary>
/// Event fired when touch action moves.
/// </summary>
static TouchDelegate TouchMove;
API_EVENT() static Delegate<const Float2&, int32> TouchMove;
/// <summary>
/// Event fired when touch action ends.
/// </summary>
static TouchDelegate TouchUp;
API_EVENT() static Delegate<const Float2&, int32> TouchUp;
public:
/// <summary>