Code style formatting and minor tweaks

#2800
This commit is contained in:
2026-02-11 17:15:15 +01:00
parent 0bea701a83
commit 273b110db4
41 changed files with 108 additions and 116 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
"Major": 1,
"Minor": 12,
"Revision": 0,
"Build": 6904
"Build": 6905
},
"Company": "Flax",
"Copyright": "Copyright (c) 2012-2026 Wojciech Figat. All rights reserved.",
+1 -1
View File
@@ -188,7 +188,7 @@
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ACCESSOR_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_CASE_STATEMENT_ON_SAME_LINE/@EntryValue">ALWAYS</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_EMBEDDED_STATEMENT_ON_SAME_LINE/@EntryValue">NEVER</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SIMPLE_CASE_STATEMENT_STYLE/@EntryValue">ON_SINGLE_LINE</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AFTER_TYPECAST_PARENTHESES/@EntryValue">False</s:Boolean>
@@ -195,7 +195,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
filesCount += files.Length;
foreach (var file in files)
FindNewKeysCpp(file, newKeys, allKeys);
files = Directory.GetFiles(Globals.ProjectSourceFolder, "*.h", SearchOption.AllDirectories).Concat(Directory.GetFiles(Globals.ProjectSourceFolder, "*.hpp", SearchOption.AllDirectories)).ToArray();;
files = Directory.GetFiles(Globals.ProjectSourceFolder, "*.h", SearchOption.AllDirectories).Concat(Directory.GetFiles(Globals.ProjectSourceFolder, "*.hpp", SearchOption.AllDirectories)).ToArray();
filesCount += files.Length;
foreach (var file in files)
FindNewKeysCpp(file, newKeys, allKeys);
+1
View File
@@ -193,6 +193,7 @@ namespace FlaxEditor.GUI.Docking
{
CreateFloating(Float2.Zero, Float2.Zero);
}
/// <summary>
/// Creates the window in a floating state.
/// </summary>
+2 -2
View File
@@ -322,7 +322,7 @@ namespace FlaxEditor.GUI.Input
#else
/// <inheritdoc />
public override void OnMouseMoveRelative(Float2 mouseMotion)
public override void OnMouseMoveRelative(Float2 motion)
{
var location = Root.TrackingMouseOffset;
if (_isSliding)
@@ -344,7 +344,7 @@ namespace FlaxEditor.GUI.Input
_cursorChanged = false;
}
base.OnMouseMoveRelative(mouseMotion);
base.OnMouseMoveRelative(motion);
}
#endif
-3
View File
@@ -1,8 +1,5 @@
// Copyright (c) Wojciech Figat. All rights reserved.
using System;
using FlaxEditor.GUI.Docking;
using FlaxEditor.Options;
using FlaxEngine;
using FlaxEngine.GUI;
+2 -2
View File
@@ -549,7 +549,7 @@ namespace FlaxEditor.Modules
public void SaveCustomViewportScalingOptions()
{
var customOptions = JsonSerializer.Serialize(CustomViewportScaleOptions);
Editor.Instance.ProjectCache.SetCustomData("CustomViewportScalingOptions", customOptions);
Editor.Instance.ProjectCache.SetCustomData("CustomViewportScalingOptions", customOptions);
}
/// <inheritdoc />
@@ -778,7 +778,7 @@ namespace FlaxEditor.Modules
MenuWindow = MainMenu.AddButton("Window");
cm = MenuWindow.ContextMenu;
cm.VisibleChanged += OnMenuWindowVisibleChanged;
cm.AddButton("Content", inputOptions.ContentWindow,Editor.Windows.ContentWin.FocusOrShow);
cm.AddButton("Content", inputOptions.ContentWindow, Editor.Windows.ContentWin.FocusOrShow);
cm.AddButton("Scene", inputOptions.SceneWindow, Editor.Windows.SceneWin.FocusOrShow);
cm.AddButton("Toolbox", inputOptions.ToolboxWindow, Editor.Windows.ToolboxWin.FocusOrShow);
cm.AddButton("Properties", inputOptions.PropertiesWindow, Editor.Windows.PropertiesWin.FocusOrShow);
+4 -2
View File
@@ -85,10 +85,12 @@ namespace FlaxEditor.Options
/// Never show the close button.
/// </summary>
Never,
/// <summary>
/// Show the close button on tabs that are currently selected.
/// </summary>
SelectedTab,
/// <summary>
/// Show the close button on all tabs that can be closed.
/// </summary>
@@ -322,7 +324,7 @@ namespace FlaxEditor.Options
#endif
/// <summary>
/// Gets or sets a value indicating wether the minum tab width should be used. Editor restart required.
/// Gets or sets a value indicating whether the minimum tab width should be used. Editor restart required.
/// </summary>
[DefaultValue(false)]
[EditorDisplay("Tabs & Windows"), EditorOrder(99)]
@@ -533,7 +535,7 @@ namespace FlaxEditor.Options
public float ConnectionCurvature { get; set; } = 1.0f;
/// <summary>
/// Gets or sets a value that indicates wether the context menu description panel is shown or not.
/// Gets or sets a value that indicates whether the context menu description panel is shown or not.
/// </summary>
[DefaultValue(true)]
[EditorDisplay("Visject"), EditorOrder(550), Tooltip("Shows/hides the description panel in visual scripting context menu.")]
@@ -2,4 +2,5 @@
#pragma once
// [Deprecated in v1.12]
#include "Engine/Platform/ScreenUtilities.h"
+6
View File
@@ -1586,6 +1586,7 @@ namespace FlaxEditor.Utilities
internal static bool UseCustomWindowDecorations(bool isMainWindow = false)
{
#if PLATFORM_SDL
return Editor.Instance.Options.Options.Interface.WindowDecorations switch
{
Options.InterfaceOptions.WindowDecorationsType.Auto => !Platform.SupportsNativeDecorations,
@@ -1594,6 +1595,11 @@ namespace FlaxEditor.Utilities
Options.InterfaceOptions.WindowDecorationsType.ClientSide => true,
_ => throw new ArgumentOutOfRangeException()
};
#elif PLATFORM_WINDOWS
return !Editor.Instance.Options.Options.Interface.UseNativeWindowSystem;
#else
return false;
#endif
}
internal static bool HideSingleTabWindowTabBars()
+2 -3
View File
@@ -1923,10 +1923,9 @@ namespace FlaxEditor.Viewport
_input.MouseWheelDelta = 0;
}
/// <inheritdoc />
public void OnMouseMoveRelative(ref Float2 mouseMotion)
private void OnMouseMoveRelative(ref Float2 motion)
{
_mouseDelta += mouseMotion;
_mouseDelta += motion;
}
/// <inheritdoc />
@@ -9,8 +9,6 @@
// Support more backbuffers in case driver decides to use more
#define VULKAN_BACK_BUFFERS_COUNT_MAX 8
class GPUDeviceVulkan;
/// <summary>
/// The implementation for the Vulkan API support for Android platform.
/// </summary>
@@ -5,7 +5,6 @@
#include "LinuxVulkanPlatform.h"
#include "../RenderToolsVulkan.h"
#include "Engine/Platform/Window.h"
#include "Engine/Platform/Linux/IncludeX11.h"
#define Display X11::Display
#define Window X11::Window
@@ -14,7 +13,6 @@
#undef Display
#undef Window
#undef VisualID
#include "vulkan/vulkan_wayland.h"
// Export extension from volk
@@ -12,8 +12,6 @@
// Prevent wierd error 'Invalid VkValidationCacheEXT Object'
#define VULKAN_USE_VALIDATION_CACHE 0
class GPUDeviceVulkan;
/// <summary>
/// The implementation for the Vulkan API support for Linux platform.
/// </summary>
@@ -11,8 +11,6 @@
// General/Validation Error:0 VK_ERROR_INITIALIZATION_FAILED: Could not create MTLCounterSampleBuffer for query pool of type VK_QUERY_TYPE_TIMESTAMP. Reverting to emulated behavior. (Error code 0): Cannot allocate sample buffer
#define VULKAN_USE_TIMER_QUERIES 0
class GPUDeviceVulkan;
/// <summary>
/// The implementation for the Vulkan API support for Mac platform.
/// </summary>
@@ -17,6 +17,8 @@ enum class VulkanValidationLevel
All = 5,
};
class GPUDeviceVulkan;
/// <summary>
/// The base implementation for the Vulkan API platform support.
/// </summary>
@@ -16,11 +16,10 @@ void Win32VulkanPlatform::GetInstanceExtensions(Array<const char*>& extensions,
void Win32VulkanPlatform::CreateSurface(Window* window, GPUDeviceVulkan* device, VkInstance instance, VkSurfaceKHR* surface)
{
void* windowHandle = window->GetNativePtr();
VkWin32SurfaceCreateInfoKHR surfaceCreateInfo;
RenderToolsVulkan::ZeroStruct(surfaceCreateInfo, VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR);
surfaceCreateInfo.hinstance = GetModuleHandle(nullptr);
surfaceCreateInfo.hwnd = static_cast<HWND>(windowHandle);
surfaceCreateInfo.hwnd = static_cast<HWND>(window->GetNativePtr());
VALIDATE_VULKAN_RESULT(vkCreateWin32SurfaceKHR(instance, &surfaceCreateInfo, nullptr, surface));
}
@@ -10,8 +10,6 @@
#define VULKAN_USE_PLATFORM_WIN32_KHX 1
#define VULKAN_USE_CREATE_WIN32_SURFACE 1
class GPUDeviceVulkan;
/// <summary>
/// The implementation for the Vulkan API support for Win32 platform.
/// </summary>
@@ -17,6 +17,7 @@ void iOSVulkanPlatform::GetInstanceExtensions(Array<const char*>& extensions, Ar
void iOSVulkanPlatform::CreateSurface(Window* window, GPUDeviceVulkan* device, VkInstance instance, VkSurfaceKHR* surface)
{
void* windowHandle = window->GetNativePtr();
// Create surface on a main UI Thread
Function<void()> func = [&windowHandle, &instance, &surface]()
{
@@ -11,8 +11,6 @@
// General/Validation Error:0 VK_ERROR_INITIALIZATION_FAILED: Could not create MTLCounterSampleBuffer for query pool of type VK_QUERY_TYPE_TIMESTAMP. Reverting to emulated behavior. (Error code 0): Cannot allocate sample buffer
#define VULKAN_USE_TIMER_QUERIES 0
class GPUDeviceVulkan;
/// <summary>
/// The implementation for the Vulkan API support for iOS platform.
/// </summary>
@@ -599,6 +599,11 @@ void WindowBase::Close(ClosingReason reason)
OnClosed();
}
bool WindowBase::IsClosed() const
{
return _isClosing || EnumHasAnyFlags(Flags, ObjectFlags::WasMarkedToDelete);
}
bool WindowBase::IsForegroundWindow() const
{
return _focused;
+1 -4
View File
@@ -242,10 +242,7 @@ public:
/// <summary>
/// Checks if window is closed.
/// </summary>
API_PROPERTY() virtual bool IsClosed() const
{
return _isClosing;
}
API_PROPERTY() virtual bool IsClosed() const;
/// <summary>
/// Checks if window is foreground (the window with which the user is currently working).
@@ -146,6 +146,7 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(CreateWindowSettings);
/// <summary>
/// True if it's a regular window, false for tooltips, context menu and other utility windows.
/// [Deprecated in v1.12]
/// </summary>
API_FIELD() DEPRECATED("Use Type instead") bool IsRegularWindow = true;
@@ -374,11 +374,6 @@ void LinuxWindow::BringToFront(bool force)
X11::XFlush(display);
}
bool LinuxWindow::IsClosed() const
{
return _isClosing;
}
bool LinuxWindow::IsForegroundWindow() const
{
return _focused || _focusOnMapped;
@@ -72,7 +72,6 @@ public:
void Minimize() override;
void Maximize() override;
void Restore() override;
bool IsClosed() const override;
bool IsForegroundWindow() const override;
void BringToFront(bool force = false) override;
void SetClientBounds(const Rectangle& clientArea) override;
-5
View File
@@ -364,11 +364,6 @@ void UWPWindow::Restore()
// Not supported
}
bool UWPWindow::IsClosed() const
{
return _isClosing;
}
void UWPWindow::BringToFront(bool force)
{
Focus();
-1
View File
@@ -160,7 +160,6 @@ public:
void Minimize() override;
void Maximize() override;
void Restore() override;
bool IsClosed() const override;
void BringToFront(bool force = false) override;
void SetClientBounds(const Rectangle& clientArea) override;
void SetPosition(const Float2& position) override;
+5 -5
View File
@@ -38,8 +38,8 @@ namespace FlaxEngine
/// <summary>
/// Perform mouse move action in relative mode.
/// </summary>
/// <param name="mouseMotion">The relative mouse motion.</param>
public delegate void MouseMoveRelativeDelegate(ref Float2 mouseMotion);
/// <param name="motion">The relative mouse motion.</param>
public delegate void MouseMoveRelativeDelegate(ref Float2 motion);
/// <summary>
/// Perform mouse wheel action.
@@ -285,10 +285,10 @@ namespace FlaxEngine
GUI.OnMouseMove(pos);
}
internal void Internal_OnMouseMoveRelative(ref Float2 mouseMotion)
internal void Internal_OnMouseMoveRelative(ref Float2 motion)
{
MouseMoveRelative?.Invoke(ref mouseMotion);
GUI.OnMouseMoveRelative(mouseMotion);
MouseMoveRelative?.Invoke(ref motion);
GUI.OnMouseMoveRelative(motion);
}
internal void Internal_OnMouseLeave()
@@ -352,7 +352,7 @@ void WindowsWindow::Restore()
bool WindowsWindow::IsClosed() const
{
return !HasHWND();
return !HasHWND() || EnumHasAnyFlags(Flags, ObjectFlags::WasMarkedToDelete);
}
bool WindowsWindow::IsForegroundWindow() const
+2 -2
View File
@@ -777,9 +777,9 @@ namespace FlaxEngine.GUI
/// <summary>
/// When mouse moves over control's area while mouse is in relative mode
/// </summary>
/// <param name="mouseMotion">Mouse relative motion</param>
/// <param name="motion">Mouse relative motion</param>
[NoAnimate]
public virtual void OnMouseMoveRelative(Float2 mouseMotion)
public virtual void OnMouseMoveRelative(Float2 motion)
{
}
+2 -2
View File
@@ -213,7 +213,7 @@ namespace FlaxEngine.GUI
var rightBottomLocationSS = locationSS + dpiSize;
// Prioritize tooltip placement within parent window, fall back to virtual desktop
/*if (rightBottomMonitorBounds.Y < rightBottomLocationSS.Y)
if (rightBottomMonitorBounds.Y < rightBottomLocationSS.Y)
{
// Direction: up
locationSS.Y -= dpiSize.Y + flipOffset;
@@ -222,7 +222,7 @@ namespace FlaxEngine.GUI
{
// Direction: left
locationSS.X -= dpiSize.X + flipOffset * 2;
}*/
}
}
/// <inheritdoc />
+3 -3
View File
@@ -340,15 +340,15 @@ namespace FlaxEngine.GUI
}
/// <inheritdoc />
public override void OnMouseMoveRelative(Float2 mouseMotion)
public override void OnMouseMoveRelative(Float2 motion)
{
if (_trackingControl != null)
{
_trackingControl.OnMouseMoveRelative(mouseMotion);
_trackingControl.OnMouseMoveRelative(motion);
return;
}
base.OnMouseMoveRelative(mouseMotion);
base.OnMouseMoveRelative(motion);
}
}
}
+9 -4
View File
@@ -288,6 +288,7 @@ namespace Flax.Build
[CommandLine("useLogInRelease", "Can be used to disable logging in Release game builds")]
public static bool UseLogInRelease = true;
/// <summary>
/// True if SDL support should be enabled.
/// </summary>
[CommandLine("useSdl", "1 to enable SDL support in build")]
@@ -311,10 +312,14 @@ namespace Flax.Build
public static bool WithSDL(NativeCpp.BuildOptions options)
{
bool supportedPlatform = options.Platform.Target == TargetPlatform.Windows ||
options.Platform.Target == TargetPlatform.Linux ||
options.Platform.Target == TargetPlatform.Mac;
return UseSDL && supportedPlatform;
switch (options.Platform.Target)
{
case TargetPlatform.Windows:
case TargetPlatform.Linux:
case TargetPlatform.Mac:
return UseSDL;
default: return false;
}
}
}
}
@@ -175,7 +175,7 @@ namespace Flax.Deps.Dependencies
RunCmake(cmakeFolder, platform, architecture, " -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF " + cmakeArgs, envVars);
// Run build
BuildCmake(cmakeFolder, envVars: envVars);
BuildCmake(cmakeFolder, envVars);
// Deploy binaries
var libs = new[]
@@ -3,15 +3,12 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using Flax.Build;
using Flax.Build.Platforms;
namespace Flax.Deps.Dependencies
{
/// <summary>
///
/// Simple DirectMedia Layer (SDL for short) is a cross-platform library designed to make it easy to write multi-media software, such as games and emulators.
/// </summary>
/// <seealso cref="Flax.Deps.Dependency" />
class SDL : Dependency
@@ -53,13 +53,16 @@ namespace Flax.Build.Platforms
options.LinkEnv.InputLibraries.Add("QuartzCore.framework");
options.LinkEnv.InputLibraries.Add("AVFoundation.framework");
// SDL3 requires the following frameworks:
options.LinkEnv.InputLibraries.Add("Foundation.framework");
options.LinkEnv.InputLibraries.Add("GameController.framework");
options.LinkEnv.InputLibraries.Add("Carbon.framework");
options.LinkEnv.InputLibraries.Add("ForceFeedback.framework");
options.LinkEnv.InputLibraries.Add("UniformTypeIdentifiers.framework");
options.LinkEnv.InputLibraries.Add("CoreHaptics.framework");
if (EngineConfiguration.WithSDL(options))
{
// SDL3 requires the following frameworks:
options.LinkEnv.InputLibraries.Add("Foundation.framework");
options.LinkEnv.InputLibraries.Add("GameController.framework");
options.LinkEnv.InputLibraries.Add("Carbon.framework");
options.LinkEnv.InputLibraries.Add("ForceFeedback.framework");
options.LinkEnv.InputLibraries.Add("UniformTypeIdentifiers.framework");
options.LinkEnv.InputLibraries.Add("CoreHaptics.framework");
}
}
protected override void AddArgsCommon(BuildOptions options, List<string> args)