// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#pragma once
#include "Engine/Core/Types/String.h"
#include "Enums.h"
#include "KeyboardKeys.h"
///
/// Maps keyboard, controller, or mouse inputs to a "friendly name" that will later be bound to continuous game behavior, such as movement. The inputs mapped in AxisMappings are continuously polled, even if they are just reporting that their input value.
///
API_STRUCT() struct ActionConfig
{
DECLARE_SCRIPTING_TYPE_MINIMAL(ActionConfig);
///
/// The action "friendly name" used to access it from code.
///
API_FIELD(Attributes="EditorOrder(0)")
String Name;
///
/// The trigger mode. Allows to specify when input event should be fired.
///
API_FIELD(Attributes="EditorOrder(5)")
InputActionMode Mode;
///
/// The keyboard key to map for this action. Use to ignore it.
///
API_FIELD(Attributes="EditorOrder(10)")
KeyboardKeys Key;
///
/// The mouse button to map for this action. Use to ignore it.
///
API_FIELD(Attributes="EditorOrder(20)")
MouseButton MouseButton;
///
/// The gamepad button to map for this action. Use to ignore it.
///
API_FIELD(Attributes="EditorOrder(30)")
GamepadButton GamepadButton;
///
/// Which gamepad should be used.
///
API_FIELD(Attributes="EditorOrder(40)")
InputGamepadIndex Gamepad;
};
///
/// Maps keyboard, controller, or mouse inputs to a "friendly name" that will later be bound to continuous game behavior, such as movement. The inputs mapped in AxisMappings are continuously polled, even if they are just reporting that their input value.
///
API_STRUCT() struct AxisConfig
{
DECLARE_SCRIPTING_TYPE_MINIMAL(AxisConfig);
///
/// The axis "friendly name" used to access it from code.
///
API_FIELD(Attributes="EditorOrder(0)")
String Name;
///
/// The axis type (mouse, gamepad, etc.).
///
API_FIELD(Attributes="EditorOrder(10)")
InputAxisType Axis;
///
/// Which gamepad should be used.
///
API_FIELD(Attributes="EditorOrder(20)")
InputGamepadIndex Gamepad;
///
/// The button to be pressed for movement in positive direction. Use to ignore it.
///
API_FIELD(Attributes="EditorOrder(30)")
KeyboardKeys PositiveButton;
///
/// The button to be pressed for movement in negative direction. Use to ignore it.
///
API_FIELD(Attributes="EditorOrder(40)")
KeyboardKeys NegativeButton;
///
/// The button to be pressed for movement in positive direction. Use to ignore it.
///
API_FIELD(Attributes="EditorOrder(45)")
GamepadButton GamepadPositiveButton;
///
/// The button to be pressed for movement in negative direction. Use to ignore it.
///
API_FIELD(Attributes="EditorOrder(46)")
GamepadButton GamepadNegativeButton;
///
/// Any positive or negative values that are less than this number will register as zero. Useful for gamepads to specify the deadzone.
///
API_FIELD(Attributes="EditorOrder(50)")
float DeadZone;
///
/// For keyboard input, a larger value will result in faster response time (in units/s). A lower value will be more smooth. For Mouse delta the value will scale the actual mouse delta.
///
API_FIELD(Attributes="EditorOrder(60)")
float Sensitivity;
///
/// For keyboard input describes how fast will the input recenter. Speed (in units/s) that output value will rest to neutral value if not when device at rest.
///
API_FIELD(Attributes="EditorOrder(70)")
float Gravity;
///
/// Additional scale parameter applied to the axis value. Allows to invert it or modify the range.
///
API_FIELD(Attributes="EditorOrder(80)")
float Scale;
///
/// If enabled, the axis value will be immediately reset to zero after it receives opposite inputs. For keyboard input only.
///
API_FIELD(Attributes="EditorOrder(90)")
bool Snap;
};