Merge iOS and macOS platform settings into shared base class
This commit is contained in:
41
Source/Engine/Platform/Apple/ApplePlatformSettings.h
Normal file
41
Source/Engine/Platform/Apple/ApplePlatformSettings.h
Normal file
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#if PLATFORM_IOS || PLATFORM_MAC || USE_EDITOR
|
||||
|
||||
#include "Engine/Core/Config/PlatformSettingsBase.h"
|
||||
#include "Engine/Core/Types/String.h"
|
||||
#include "Engine/Scripting/SoftObjectReference.h"
|
||||
|
||||
class Texture;
|
||||
|
||||
/// <summary>
|
||||
/// Apple platform settings.
|
||||
/// </summary>
|
||||
API_CLASS(abstract, Namespace="FlaxEditor.Content.Settings") class FLAXENGINE_API ApplePlatformSettings : public SettingsBase
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(ApplePlatformSettings);
|
||||
|
||||
/// <summary>
|
||||
/// The app identifier (reversed DNS, eg. com.company.product). Custom tokens: ${PROJECT_NAME}, ${COMPANY_NAME}.
|
||||
/// </summary>
|
||||
API_FIELD(Attributes="EditorOrder(0), EditorDisplay(\"General\")")
|
||||
String AppIdentifier = TEXT("com.${COMPANY_NAME}.${PROJECT_NAME}");
|
||||
|
||||
/// <summary>
|
||||
/// Custom icon texture to use for the application (overrides the default one).
|
||||
/// </summary>
|
||||
API_FIELD(Attributes="EditorOrder(1000), EditorDisplay(\"Other\")")
|
||||
SoftObjectReference<Texture> OverrideIcon;
|
||||
|
||||
public:
|
||||
// [SettingsBase]
|
||||
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override
|
||||
{
|
||||
DESERIALIZE(AppIdentifier);
|
||||
DESERIALIZE(OverrideIcon);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -4,25 +4,15 @@
|
||||
|
||||
#if PLATFORM_MAC || USE_EDITOR
|
||||
|
||||
#include "Engine/Core/Config/PlatformSettingsBase.h"
|
||||
#include "Engine/Core/Types/String.h"
|
||||
#include "Engine/Scripting/SoftObjectReference.h"
|
||||
|
||||
class Texture;
|
||||
#include "../Apple/ApplePlatformSettings.h"
|
||||
|
||||
/// <summary>
|
||||
/// Mac platform settings.
|
||||
/// </summary>
|
||||
API_CLASS(sealed, Namespace="FlaxEditor.Content.Settings") class FLAXENGINE_API MacPlatformSettings : public SettingsBase
|
||||
API_CLASS(sealed, Namespace="FlaxEditor.Content.Settings") class FLAXENGINE_API MacPlatformSettings : public ApplePlatformSettings
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(MacPlatformSettings);
|
||||
|
||||
/// <summary>
|
||||
/// The app identifier (reversed DNS, eg. com.company.product). Custom tokens: ${PROJECT_NAME}, ${COMPANY_NAME}.
|
||||
/// </summary>
|
||||
API_FIELD(Attributes="EditorOrder(0), EditorDisplay(\"General\")")
|
||||
String AppIdentifier = TEXT("com.${COMPANY_NAME}.${PROJECT_NAME}");
|
||||
|
||||
/// <summary>
|
||||
/// The default game window mode.
|
||||
/// </summary>
|
||||
@@ -47,12 +37,6 @@ API_CLASS(sealed, Namespace="FlaxEditor.Content.Settings") class FLAXENGINE_API
|
||||
API_FIELD(Attributes="EditorOrder(140), EditorDisplay(\"Window\")")
|
||||
bool ResizableWindow = false;
|
||||
|
||||
/// <summary>
|
||||
/// Custom icon texture to use for the application (overrides the default one).
|
||||
/// </summary>
|
||||
API_FIELD(Attributes="EditorOrder(1000), EditorDisplay(\"Other\")")
|
||||
SoftObjectReference<Texture> OverrideIcon;
|
||||
|
||||
/// <summary>
|
||||
/// Enables game running when application window loses focus.
|
||||
/// </summary>
|
||||
@@ -68,12 +52,11 @@ public:
|
||||
// [SettingsBase]
|
||||
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) final override
|
||||
{
|
||||
DESERIALIZE(AppIdentifier);
|
||||
ApplePlatformSettings::Deserialize(stream, modifier);
|
||||
DESERIALIZE(WindowMode);
|
||||
DESERIALIZE(ScreenWidth);
|
||||
DESERIALIZE(ScreenHeight);
|
||||
DESERIALIZE(ResizableWindow);
|
||||
DESERIALIZE(OverrideIcon);
|
||||
DESERIALIZE(RunInBackground);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,32 +4,15 @@
|
||||
|
||||
#if PLATFORM_IOS || USE_EDITOR
|
||||
|
||||
#include "Engine/Core/Config/PlatformSettingsBase.h"
|
||||
#include "Engine/Core/Types/String.h"
|
||||
#include "Engine/Scripting/SoftObjectReference.h"
|
||||
|
||||
class Texture;
|
||||
#include "../Apple/ApplePlatformSettings.h"
|
||||
|
||||
/// <summary>
|
||||
/// iOS platform settings.
|
||||
/// </summary>
|
||||
API_CLASS(sealed, Namespace="FlaxEditor.Content.Settings") class FLAXENGINE_API iOSPlatformSettings : public SettingsBase
|
||||
API_CLASS(sealed, Namespace="FlaxEditor.Content.Settings") class FLAXENGINE_API iOSPlatformSettings : public ApplePlatformSettings
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(iOSPlatformSettings);
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(ApplePlatformSettings);
|
||||
|
||||
/// <summary>
|
||||
/// The app identifier (reversed DNS, eg. com.company.product). Custom tokens: ${PROJECT_NAME}, ${COMPANY_NAME}.
|
||||
/// </summary>
|
||||
API_FIELD(Attributes="EditorOrder(0), EditorDisplay(\"General\")")
|
||||
String AppIdentifier = TEXT("com.${COMPANY_NAME}.${PROJECT_NAME}");
|
||||
|
||||
/// <summary>
|
||||
/// Custom icon texture to use for the application (overrides the default one).
|
||||
/// </summary>
|
||||
API_FIELD(Attributes="EditorOrder(1000), EditorDisplay(\"Other\")")
|
||||
SoftObjectReference<Texture> OverrideIcon;
|
||||
|
||||
public:
|
||||
/// <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>
|
||||
@@ -38,8 +21,7 @@ public:
|
||||
// [SettingsBase]
|
||||
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) final override
|
||||
{
|
||||
DESERIALIZE(AppIdentifier);
|
||||
DESERIALIZE(OverrideIcon);
|
||||
ApplePlatformSettings::Deserialize(stream, modifier);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user