Refactor settings types to use scripting API
This commit is contained in:
@@ -98,6 +98,12 @@ Delegate<StringView> Input::ActionTriggered;
|
||||
Array<ActionConfig> Input::ActionMappings;
|
||||
Array<AxisConfig> Input::AxisMappings;
|
||||
|
||||
void InputSettings::Apply()
|
||||
{
|
||||
Input::ActionMappings = ActionMappings;
|
||||
Input::AxisMappings = AxisMappings;
|
||||
}
|
||||
|
||||
int32 Input::GetGamepadsCount()
|
||||
{
|
||||
return Gamepads.Count();
|
||||
|
||||
@@ -21,7 +21,6 @@ class InputDevice;
|
||||
API_CLASS(Static) class FLAXENGINE_API Input
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(Input);
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the mouse (null if platform does not support mouse or it is not connected).
|
||||
|
||||
@@ -5,14 +5,13 @@
|
||||
#include "Engine/Core/Config/Settings.h"
|
||||
#include "Engine/Serialization/JsonTools.h"
|
||||
#include "VirtualInput.h"
|
||||
#include "Input.h"
|
||||
|
||||
/// <summary>
|
||||
/// Input settings container.
|
||||
/// </summary>
|
||||
/// <seealso cref="SettingsBase{InputSettings}" />
|
||||
class InputSettings : public SettingsBase<InputSettings>
|
||||
API_CLASS(sealed, Namespace="FlaxEditor.Content.Settings") class FLAXENGINE_API InputSettings : public SettingsBase
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(InputSettings);
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
@@ -27,19 +26,14 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
// [SettingsBase]
|
||||
void Apply() override
|
||||
{
|
||||
Input::ActionMappings = ActionMappings;
|
||||
Input::AxisMappings = AxisMappings;
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the instance of the settings asset (default value if missing). Object returned by this method is always loaded with valid data to use.
|
||||
/// </summary>
|
||||
static InputSettings* Get();
|
||||
|
||||
// [SettingsBase]
|
||||
void Apply() override;
|
||||
|
||||
void RestoreDefault() override
|
||||
{
|
||||
ActionMappings.Resize(0);
|
||||
AxisMappings.Resize(0);
|
||||
}
|
||||
|
||||
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) final override
|
||||
{
|
||||
const auto actionMappings = stream.FindMember("ActionMappings");
|
||||
|
||||
Reference in New Issue
Block a user