From 273b110db4a0b109ad3ba8a904c2a77f89c8a4e8 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 11 Feb 2026 17:15:15 +0100 Subject: [PATCH] Code style formatting and minor tweaks #2800 --- Flax.flaxproj | 2 +- Flax.sln.DotSettings | 2 +- .../Dedicated/LocalizationSettingsEditor.cs | 2 +- .../Editor/GUI/ContextMenu/ContextMenuBase.cs | 2 +- Source/Editor/GUI/Docking/DockPanelProxy.cs | 2 +- Source/Editor/GUI/Docking/DockWindow.cs | 1 + .../GUI/Docking/FloatWindowDockPanel.cs | 12 +++---- Source/Editor/GUI/Input/ValueBox.cs | 4 +-- Source/Editor/GUI/WindowDecorations.cs | 31 +++++++++---------- Source/Editor/Modules/UIModule.cs | 26 ++++++++-------- Source/Editor/Options/InterfaceOptions.cs | 14 +++++---- Source/Editor/Utilities/ScreenUtilities.h | 1 + Source/Editor/Utilities/Utils.cs | 6 ++++ Source/Editor/Viewport/EditorViewport.cs | 5 ++- .../Vulkan/Android/AndroidVulkanPlatform.h | 2 -- .../Vulkan/Linux/LinuxVulkanPlatform.cpp | 2 -- .../Vulkan/Linux/LinuxVulkanPlatform.h | 2 -- .../Vulkan/Mac/MacVulkanPlatform.h | 2 -- .../Vulkan/VulkanPlatformBase.h | 2 ++ .../Vulkan/Win32/Win32VulkanPlatform.cpp | 3 +- .../Vulkan/Win32/Win32VulkanPlatform.h | 2 -- .../Vulkan/iOS/iOSVulkanPlatform.cpp | 1 + .../Vulkan/iOS/iOSVulkanPlatform.h | 2 -- Source/Engine/Input/Mouse.h | 2 +- Source/Engine/Platform/Base/WindowBase.cpp | 5 +++ Source/Engine/Platform/Base/WindowBase.h | 5 +-- Source/Engine/Platform/CreateWindowSettings.h | 1 + Source/Engine/Platform/Linux/LinuxWindow.cpp | 5 --- Source/Engine/Platform/Linux/LinuxWindow.h | 1 - Source/Engine/Platform/UWP/UWPWindow.cpp | 5 --- Source/Engine/Platform/UWP/UWPWindow.h | 1 - Source/Engine/Platform/Window.cs | 12 +++---- .../Engine/Platform/Windows/WindowsWindow.cpp | 2 +- Source/Engine/UI/GUI/Control.cs | 6 ++-- Source/Engine/UI/GUI/Tooltip.cs | 4 +-- Source/Engine/UI/GUI/WindowRootControl.cs | 6 ++-- Source/Tools/Flax.Build/Configuration.cs | 13 +++++--- .../Flax.Build/Deps/Dependencies/NvCloth.cs | 2 +- .../Tools/Flax.Build/Deps/Dependencies/SDL.cs | 5 +-- .../Flax.Build/Platforms/Mac/MacToolchain.cs | 17 +++++----- .../Platforms/Unix/UnixToolchain.cs | 4 +-- 41 files changed, 108 insertions(+), 116 deletions(-) diff --git a/Flax.flaxproj b/Flax.flaxproj index 75dd90447..3ee8f392f 100644 --- a/Flax.flaxproj +++ b/Flax.flaxproj @@ -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.", diff --git a/Flax.sln.DotSettings b/Flax.sln.DotSettings index f54190003..5a027a4d2 100644 --- a/Flax.sln.DotSettings +++ b/Flax.sln.DotSettings @@ -188,7 +188,7 @@ False NEVER False - ALWAYS + NEVER ON_SINGLE_LINE False diff --git a/Source/Editor/CustomEditors/Dedicated/LocalizationSettingsEditor.cs b/Source/Editor/CustomEditors/Dedicated/LocalizationSettingsEditor.cs index 79e512122..960d5ad27 100644 --- a/Source/Editor/CustomEditors/Dedicated/LocalizationSettingsEditor.cs +++ b/Source/Editor/CustomEditors/Dedicated/LocalizationSettingsEditor.cs @@ -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); diff --git a/Source/Editor/GUI/ContextMenu/ContextMenuBase.cs b/Source/Editor/GUI/ContextMenu/ContextMenuBase.cs index 041d4f053..d3af7b5cd 100644 --- a/Source/Editor/GUI/ContextMenu/ContextMenuBase.cs +++ b/Source/Editor/GUI/ContextMenu/ContextMenuBase.cs @@ -279,7 +279,7 @@ namespace FlaxEditor.GUI.ContextMenu _window.GotFocus += OnWindowGotFocus; _window.LostFocus += OnWindowLostFocus; } - + #if USE_IS_FOREGROUND && USE_SDL_WORKAROUNDS // The focus between popup and parent windows doesn't change, force hide the popup when clicked on parent parentWin.Window.MouseDown += OnWindowMouseDown; diff --git a/Source/Editor/GUI/Docking/DockPanelProxy.cs b/Source/Editor/GUI/Docking/DockPanelProxy.cs index 014433b26..c3fc0fa13 100644 --- a/Source/Editor/GUI/Docking/DockPanelProxy.cs +++ b/Source/Editor/GUI/Docking/DockPanelProxy.cs @@ -50,7 +50,7 @@ namespace FlaxEditor.GUI.Docking /// The mouse position. /// public Float2 MousePosition = Float2.Minimum; - + /// /// The mouse position. /// diff --git a/Source/Editor/GUI/Docking/DockWindow.cs b/Source/Editor/GUI/Docking/DockWindow.cs index 2770a8d84..c793dacfa 100644 --- a/Source/Editor/GUI/Docking/DockWindow.cs +++ b/Source/Editor/GUI/Docking/DockWindow.cs @@ -193,6 +193,7 @@ namespace FlaxEditor.GUI.Docking { CreateFloating(Float2.Zero, Float2.Zero); } + /// /// Creates the window in a floating state. /// diff --git a/Source/Editor/GUI/Docking/FloatWindowDockPanel.cs b/Source/Editor/GUI/Docking/FloatWindowDockPanel.cs index df19245e4..2a674ce5c 100644 --- a/Source/Editor/GUI/Docking/FloatWindowDockPanel.cs +++ b/Source/Editor/GUI/Docking/FloatWindowDockPanel.cs @@ -14,13 +14,13 @@ namespace FlaxEditor.GUI.Docking private class FloatWindowDecorations : WindowDecorations { private FloatWindowDockPanel _panel; - + public FloatWindowDecorations(FloatWindowDockPanel panel) : base(panel.RootWindow) { _panel = panel; } - + /// public override bool OnMouseDown(Float2 location, MouseButton button) { @@ -76,19 +76,19 @@ namespace FlaxEditor.GUI.Docking Parent = window; _window.Window.Closing += OnClosing; _window.Window.LeftButtonHit += OnLeftButtonHit; - + if (Utilities.Utils.UseCustomWindowDecorations()) { var decorations = Parent.AddChild(new FloatWindowDecorations(this)); decorations.SetAnchorPreset(AnchorPresets.HorizontalStretchTop, false); } } - + /// protected override void PerformLayoutBeforeChildren() { base.PerformLayoutBeforeChildren(); - + var decorations = Parent.GetChild(); if (decorations != null) { @@ -143,7 +143,7 @@ namespace FlaxEditor.GUI.Docking settings.ShowAfterFirstPaint = false; settings.ShowInTaskbar = true; settings.StartPosition = startPosition; - + if (Utilities.Utils.UseCustomWindowDecorations()) { settings.HasBorder = false; diff --git a/Source/Editor/GUI/Input/ValueBox.cs b/Source/Editor/GUI/Input/ValueBox.cs index 5e1e4aaf4..8e3e4f4e7 100644 --- a/Source/Editor/GUI/Input/ValueBox.cs +++ b/Source/Editor/GUI/Input/ValueBox.cs @@ -322,7 +322,7 @@ namespace FlaxEditor.GUI.Input #else /// - 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 diff --git a/Source/Editor/GUI/WindowDecorations.cs b/Source/Editor/GUI/WindowDecorations.cs index 72f62e3e5..74dc38273 100644 --- a/Source/Editor/GUI/WindowDecorations.cs +++ b/Source/Editor/GUI/WindowDecorations.cs @@ -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; @@ -26,12 +23,12 @@ public class WindowDecorations : ContainerControl /// The title label in the title bar. /// public Label Title => _title; - + /// /// The icon used in the title bar. /// public Image Icon => _icon; - + /// /// The tooltip shown when hovering over the icon. /// @@ -54,7 +51,7 @@ public class WindowDecorations : ContainerControl : base(0, 0, 0, 20) { _window = window.RootWindow.Window; - + AutoFocus = false; AnchorPreset = AnchorPresets.HorizontalStretchTop; BackgroundColor = Color.Transparent; @@ -75,13 +72,13 @@ public class WindowDecorations : ContainerControl { _icon.Margin = new Margin(6, 6, 6, 6); Height = 28; - + _window.HitTest += OnHitTest; _window.Closed += OnWindowClosed; - + FontAsset windowIconsFont = FlaxEngine.Content.LoadAsyncInternal(EditorAssets.WindowIconsFont); Font iconFont = windowIconsFont?.CreateFont(9); - + _title = new Label(0, 0, Width, Height) { Text = _window.Title, @@ -150,7 +147,7 @@ public class WindowDecorations : ContainerControl _charChromeMaximize = ((char)EditorAssets.SegMDL2Icons.ChromeMaximize).ToString(); } } - + /// public override void Update(float deltaTime) { @@ -216,20 +213,20 @@ public class WindowDecorations : ContainerControl if (pos.Y > winSize.Y - distance) return WindowHitCodes.Bottom; } - + var controlUnderMouse = GetChildAt(pos, control => control != _title); if (_title.Bounds.Contains(pos) && controlUnderMouse == null) return WindowHitCodes.Caption; return WindowHitCodes.Client; } - + /// public override bool OnMouseDoubleClick(Float2 location, MouseButton button) { // These may not work with main window due to SDL not passing mouse events // when interacting with hit tests on caption area... - + if (Title.Bounds.Contains(location) && button == MouseButton.Left) { if (_window.IsMaximized) @@ -251,7 +248,7 @@ public class WindowDecorations : ContainerControl { // Calculate extents for title bounds area excluding the icon and main menu area float x = 0; - + // Icon if (_icon != null) { @@ -273,7 +270,7 @@ public class WindowDecorations : ContainerControl } } } - + // Buttons float rightMostButtonX = Width; if (_closeButton != null) @@ -302,7 +299,7 @@ public class WindowDecorations : ContainerControl _title.Bounds = new Rectangle(x, 0, rightMostButtonX - x, Height); } } - + /// public override void Draw() { @@ -321,7 +318,7 @@ public class WindowDecorations : ContainerControl if (Editor.Instance.UI.StatusBar == null) return; - + const float thickness = 1.0f; Color color = Editor.Instance.UI.StatusBar.StatusColor; Rectangle rect = new Rectangle(thickness * 0.5f, thickness * 0.5f, Parent.Width - thickness, Parent.Height - thickness); diff --git a/Source/Editor/Modules/UIModule.cs b/Source/Editor/Modules/UIModule.cs index d0604aace..cb7c76b5b 100644 --- a/Source/Editor/Modules/UIModule.cs +++ b/Source/Editor/Modules/UIModule.cs @@ -30,7 +30,7 @@ namespace FlaxEditor.Modules { private class MainWindowDecorations : WindowDecorations { - public MainWindowDecorations(RootControl window, bool iconOnly) + public MainWindowDecorations(RootControl window, bool iconOnly) : base(window, iconOnly) { } @@ -45,7 +45,7 @@ namespace FlaxEditor.Modules var editor = Editor.Instance; return editor.Windows.EditWin.InputActions.Process(editor, this, key); } - + /// public override void DrawBorders() { @@ -61,7 +61,7 @@ namespace FlaxEditor.Modules Render2D.DrawLine(rect.UpperRight, rect.BottomRight, color); } } - + private struct Status { public int ID; @@ -78,7 +78,7 @@ namespace FlaxEditor.Modules private bool _progressFailed; ContextMenuSingleSelectGroup _numberOfClientsGroup = new ContextMenuSingleSelectGroup(); - + /// /// Defines a viewport scaling option. /// @@ -99,7 +99,7 @@ namespace FlaxEditor.Modules /// Aspect = 1, } - + /// /// The name. /// @@ -115,7 +115,7 @@ namespace FlaxEditor.Modules /// public Int2 Size; } - + /// /// The default viewport scaling options. /// @@ -486,7 +486,7 @@ namespace FlaxEditor.Modules // Update window background mainWindow.BackgroundColor = Style.Current.Background; - + InitViewportScaleOptions(); InitSharedMenus(); @@ -497,7 +497,7 @@ namespace FlaxEditor.Modules InitWindowDecorations(mainWindow); Editor.Options.OptionsChanged += OnOptionsChanged; - + mainWindow.PerformLayout(true); } @@ -536,7 +536,7 @@ namespace FlaxEditor.Modules Size = new Int2(2560, 1440), }); } - + if (Editor.Instance.ProjectCache.TryGetCustomData("CustomViewportScalingOptions", out string data)) { CustomViewportScaleOptions = JsonSerializer.Deserialize>(data); @@ -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); } /// @@ -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); @@ -817,14 +817,14 @@ namespace FlaxEditor.Modules var driver = Platform.DisplayServer; if (!string.IsNullOrEmpty(driver)) driver = $" ({driver})"; - + WindowDecorations = new MainWindowDecorations(mainWindow, !Utilities.Utils.UseCustomWindowDecorations(isMainWindow: true)) { Parent = mainWindow, IconTooltipText = $"{mainWindow.RootWindow.Title}\nVersion {Globals.EngineVersion}\nConfiguration {configuration}\nGraphics {GPUDevice.Instance.RendererType}{driver}", }; } - + private void OnOptionsChanged(EditorOptions options) { var inputOptions = options.Input; diff --git a/Source/Editor/Options/InterfaceOptions.cs b/Source/Editor/Options/InterfaceOptions.cs index 172f63f36..dd38ea4ee 100644 --- a/Source/Editor/Options/InterfaceOptions.cs +++ b/Source/Editor/Options/InterfaceOptions.cs @@ -85,10 +85,12 @@ namespace FlaxEditor.Options /// Never show the close button. /// Never, + /// /// Show the close button on tabs that are currently selected. /// SelectedTab, + /// /// Show the close button on all tabs that can be closed. /// @@ -188,18 +190,18 @@ namespace FlaxEditor.Options /// Determined automatically based on the system and any known compatibility issues with native decorations. /// Auto, - + /// /// Automatically choose most compatible window decorations for child windows, prefer custom decorations on main window. /// [EditorDisplay(Name = "Auto (Child Only)")] AutoChildOnly, - + /// /// Use native system window decorations on all windows. /// Native, - + /// /// Use custom client-side window decorations on all windows. /// @@ -322,7 +324,7 @@ namespace FlaxEditor.Options #endif /// - /// 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. /// [DefaultValue(false)] [EditorDisplay("Tabs & Windows"), EditorOrder(99)] @@ -518,7 +520,7 @@ namespace FlaxEditor.Options [DefaultValue(1), Range(1, 4)] [EditorDisplay("Cook & Run"), EditorOrder(600)] public int NumberOfGameClientsToLaunch = 1; - + /// /// Gets or sets the build configuration to use when using Cook and Run option in the editor. /// @@ -533,7 +535,7 @@ namespace FlaxEditor.Options public float ConnectionCurvature { get; set; } = 1.0f; /// - /// 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. /// [DefaultValue(true)] [EditorDisplay("Visject"), EditorOrder(550), Tooltip("Shows/hides the description panel in visual scripting context menu.")] diff --git a/Source/Editor/Utilities/ScreenUtilities.h b/Source/Editor/Utilities/ScreenUtilities.h index be946dcae..4e56a09ed 100644 --- a/Source/Editor/Utilities/ScreenUtilities.h +++ b/Source/Editor/Utilities/ScreenUtilities.h @@ -2,4 +2,5 @@ #pragma once +// [Deprecated in v1.12] #include "Engine/Platform/ScreenUtilities.h" diff --git a/Source/Editor/Utilities/Utils.cs b/Source/Editor/Utilities/Utils.cs index ea55edc0b..00853860c 100644 --- a/Source/Editor/Utilities/Utils.cs +++ b/Source/Editor/Utilities/Utils.cs @@ -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() diff --git a/Source/Editor/Viewport/EditorViewport.cs b/Source/Editor/Viewport/EditorViewport.cs index 82789e7e5..a996fa628 100644 --- a/Source/Editor/Viewport/EditorViewport.cs +++ b/Source/Editor/Viewport/EditorViewport.cs @@ -1923,10 +1923,9 @@ namespace FlaxEditor.Viewport _input.MouseWheelDelta = 0; } - /// - public void OnMouseMoveRelative(ref Float2 mouseMotion) + private void OnMouseMoveRelative(ref Float2 motion) { - _mouseDelta += mouseMotion; + _mouseDelta += motion; } /// diff --git a/Source/Engine/GraphicsDevice/Vulkan/Android/AndroidVulkanPlatform.h b/Source/Engine/GraphicsDevice/Vulkan/Android/AndroidVulkanPlatform.h index 9a7dbe5b8..30f7f5206 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/Android/AndroidVulkanPlatform.h +++ b/Source/Engine/GraphicsDevice/Vulkan/Android/AndroidVulkanPlatform.h @@ -9,8 +9,6 @@ // Support more backbuffers in case driver decides to use more #define VULKAN_BACK_BUFFERS_COUNT_MAX 8 -class GPUDeviceVulkan; - /// /// The implementation for the Vulkan API support for Android platform. /// diff --git a/Source/Engine/GraphicsDevice/Vulkan/Linux/LinuxVulkanPlatform.cpp b/Source/Engine/GraphicsDevice/Vulkan/Linux/LinuxVulkanPlatform.cpp index d8912a767..659c46f32 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/Linux/LinuxVulkanPlatform.cpp +++ b/Source/Engine/GraphicsDevice/Vulkan/Linux/LinuxVulkanPlatform.cpp @@ -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 diff --git a/Source/Engine/GraphicsDevice/Vulkan/Linux/LinuxVulkanPlatform.h b/Source/Engine/GraphicsDevice/Vulkan/Linux/LinuxVulkanPlatform.h index 11d2008cd..1f4c17a07 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/Linux/LinuxVulkanPlatform.h +++ b/Source/Engine/GraphicsDevice/Vulkan/Linux/LinuxVulkanPlatform.h @@ -12,8 +12,6 @@ // Prevent wierd error 'Invalid VkValidationCacheEXT Object' #define VULKAN_USE_VALIDATION_CACHE 0 -class GPUDeviceVulkan; - /// /// The implementation for the Vulkan API support for Linux platform. /// diff --git a/Source/Engine/GraphicsDevice/Vulkan/Mac/MacVulkanPlatform.h b/Source/Engine/GraphicsDevice/Vulkan/Mac/MacVulkanPlatform.h index 2f4f93d2f..a4f7b0a3f 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/Mac/MacVulkanPlatform.h +++ b/Source/Engine/GraphicsDevice/Vulkan/Mac/MacVulkanPlatform.h @@ -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; - /// /// The implementation for the Vulkan API support for Mac platform. /// diff --git a/Source/Engine/GraphicsDevice/Vulkan/VulkanPlatformBase.h b/Source/Engine/GraphicsDevice/Vulkan/VulkanPlatformBase.h index 2122b3709..3095472ee 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/VulkanPlatformBase.h +++ b/Source/Engine/GraphicsDevice/Vulkan/VulkanPlatformBase.h @@ -17,6 +17,8 @@ enum class VulkanValidationLevel All = 5, }; +class GPUDeviceVulkan; + /// /// The base implementation for the Vulkan API platform support. /// diff --git a/Source/Engine/GraphicsDevice/Vulkan/Win32/Win32VulkanPlatform.cpp b/Source/Engine/GraphicsDevice/Vulkan/Win32/Win32VulkanPlatform.cpp index 08bd300ae..8b23b4024 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/Win32/Win32VulkanPlatform.cpp +++ b/Source/Engine/GraphicsDevice/Vulkan/Win32/Win32VulkanPlatform.cpp @@ -16,11 +16,10 @@ void Win32VulkanPlatform::GetInstanceExtensions(Array& 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(windowHandle); + surfaceCreateInfo.hwnd = static_cast(window->GetNativePtr()); VALIDATE_VULKAN_RESULT(vkCreateWin32SurfaceKHR(instance, &surfaceCreateInfo, nullptr, surface)); } diff --git a/Source/Engine/GraphicsDevice/Vulkan/Win32/Win32VulkanPlatform.h b/Source/Engine/GraphicsDevice/Vulkan/Win32/Win32VulkanPlatform.h index 2de527e2f..96dbf2e18 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/Win32/Win32VulkanPlatform.h +++ b/Source/Engine/GraphicsDevice/Vulkan/Win32/Win32VulkanPlatform.h @@ -10,8 +10,6 @@ #define VULKAN_USE_PLATFORM_WIN32_KHX 1 #define VULKAN_USE_CREATE_WIN32_SURFACE 1 -class GPUDeviceVulkan; - /// /// The implementation for the Vulkan API support for Win32 platform. /// diff --git a/Source/Engine/GraphicsDevice/Vulkan/iOS/iOSVulkanPlatform.cpp b/Source/Engine/GraphicsDevice/Vulkan/iOS/iOSVulkanPlatform.cpp index 58b4e3183..54e147214 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/iOS/iOSVulkanPlatform.cpp +++ b/Source/Engine/GraphicsDevice/Vulkan/iOS/iOSVulkanPlatform.cpp @@ -17,6 +17,7 @@ void iOSVulkanPlatform::GetInstanceExtensions(Array& 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 func = [&windowHandle, &instance, &surface]() { diff --git a/Source/Engine/GraphicsDevice/Vulkan/iOS/iOSVulkanPlatform.h b/Source/Engine/GraphicsDevice/Vulkan/iOS/iOSVulkanPlatform.h index 5fc306e36..d1c5f64ad 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/iOS/iOSVulkanPlatform.h +++ b/Source/Engine/GraphicsDevice/Vulkan/iOS/iOSVulkanPlatform.h @@ -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; - /// /// The implementation for the Vulkan API support for iOS platform. /// diff --git a/Source/Engine/Input/Mouse.h b/Source/Engine/Input/Mouse.h index d9d2221dd..92dad9595 100644 --- a/Source/Engine/Input/Mouse.h +++ b/Source/Engine/Input/Mouse.h @@ -117,7 +117,7 @@ public: } /// - /// Gets the current state of mouse relative mode. + /// Gets the current state of mouse relative mode. /// /// The window to check against, or null to check for any window. /// True if mouse is in relative mode, otherwise false. diff --git a/Source/Engine/Platform/Base/WindowBase.cpp b/Source/Engine/Platform/Base/WindowBase.cpp index cd96dca41..86247763f 100644 --- a/Source/Engine/Platform/Base/WindowBase.cpp +++ b/Source/Engine/Platform/Base/WindowBase.cpp @@ -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; diff --git a/Source/Engine/Platform/Base/WindowBase.h b/Source/Engine/Platform/Base/WindowBase.h index 9cf1cc771..f11abb398 100644 --- a/Source/Engine/Platform/Base/WindowBase.h +++ b/Source/Engine/Platform/Base/WindowBase.h @@ -242,10 +242,7 @@ public: /// /// Checks if window is closed. /// - API_PROPERTY() virtual bool IsClosed() const - { - return _isClosing; - } + API_PROPERTY() virtual bool IsClosed() const; /// /// Checks if window is foreground (the window with which the user is currently working). diff --git a/Source/Engine/Platform/CreateWindowSettings.h b/Source/Engine/Platform/CreateWindowSettings.h index 2df533b7c..4285bee1c 100644 --- a/Source/Engine/Platform/CreateWindowSettings.h +++ b/Source/Engine/Platform/CreateWindowSettings.h @@ -146,6 +146,7 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(CreateWindowSettings); /// /// True if it's a regular window, false for tooltips, context menu and other utility windows. + /// [Deprecated in v1.12] /// API_FIELD() DEPRECATED("Use Type instead") bool IsRegularWindow = true; diff --git a/Source/Engine/Platform/Linux/LinuxWindow.cpp b/Source/Engine/Platform/Linux/LinuxWindow.cpp index 4850c1e3b..3eeacc5e3 100644 --- a/Source/Engine/Platform/Linux/LinuxWindow.cpp +++ b/Source/Engine/Platform/Linux/LinuxWindow.cpp @@ -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; diff --git a/Source/Engine/Platform/Linux/LinuxWindow.h b/Source/Engine/Platform/Linux/LinuxWindow.h index 67a40859d..468e062ad 100644 --- a/Source/Engine/Platform/Linux/LinuxWindow.h +++ b/Source/Engine/Platform/Linux/LinuxWindow.h @@ -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; diff --git a/Source/Engine/Platform/UWP/UWPWindow.cpp b/Source/Engine/Platform/UWP/UWPWindow.cpp index 0a061e427..05a88306a 100644 --- a/Source/Engine/Platform/UWP/UWPWindow.cpp +++ b/Source/Engine/Platform/UWP/UWPWindow.cpp @@ -364,11 +364,6 @@ void UWPWindow::Restore() // Not supported } -bool UWPWindow::IsClosed() const -{ - return _isClosing; -} - void UWPWindow::BringToFront(bool force) { Focus(); diff --git a/Source/Engine/Platform/UWP/UWPWindow.h b/Source/Engine/Platform/UWP/UWPWindow.h index b5a1f9c53..6f4f0400b 100644 --- a/Source/Engine/Platform/UWP/UWPWindow.h +++ b/Source/Engine/Platform/UWP/UWPWindow.h @@ -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; diff --git a/Source/Engine/Platform/Window.cs b/Source/Engine/Platform/Window.cs index 06b02457a..1a593616d 100644 --- a/Source/Engine/Platform/Window.cs +++ b/Source/Engine/Platform/Window.cs @@ -34,12 +34,12 @@ namespace FlaxEngine /// /// The mouse position. public delegate void MouseMoveDelegate(ref Float2 mousePosition); - + /// /// Perform mouse move action in relative mode. /// - /// The relative mouse motion. - public delegate void MouseMoveRelativeDelegate(ref Float2 mouseMotion); + /// The relative mouse motion. + public delegate void MouseMoveRelativeDelegate(ref Float2 motion); /// /// 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() diff --git a/Source/Engine/Platform/Windows/WindowsWindow.cpp b/Source/Engine/Platform/Windows/WindowsWindow.cpp index d3d18305a..663bb1299 100644 --- a/Source/Engine/Platform/Windows/WindowsWindow.cpp +++ b/Source/Engine/Platform/Windows/WindowsWindow.cpp @@ -352,7 +352,7 @@ void WindowsWindow::Restore() bool WindowsWindow::IsClosed() const { - return !HasHWND(); + return !HasHWND() || EnumHasAnyFlags(Flags, ObjectFlags::WasMarkedToDelete); } bool WindowsWindow::IsForegroundWindow() const diff --git a/Source/Engine/UI/GUI/Control.cs b/Source/Engine/UI/GUI/Control.cs index c979b3249..f3eae8a24 100644 --- a/Source/Engine/UI/GUI/Control.cs +++ b/Source/Engine/UI/GUI/Control.cs @@ -773,13 +773,13 @@ namespace FlaxEngine.GUI Tooltip?.OnMouseLeaveControl(this); } } - + /// /// When mouse moves over control's area while mouse is in relative mode /// - /// Mouse relative motion + /// Mouse relative motion [NoAnimate] - public virtual void OnMouseMoveRelative(Float2 mouseMotion) + public virtual void OnMouseMoveRelative(Float2 motion) { } diff --git a/Source/Engine/UI/GUI/Tooltip.cs b/Source/Engine/UI/GUI/Tooltip.cs index bc1b968b2..ea3c27658 100644 --- a/Source/Engine/UI/GUI/Tooltip.cs +++ b/Source/Engine/UI/GUI/Tooltip.cs @@ -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; - }*/ + } } /// diff --git a/Source/Engine/UI/GUI/WindowRootControl.cs b/Source/Engine/UI/GUI/WindowRootControl.cs index b3db7f6eb..3b4786db0 100644 --- a/Source/Engine/UI/GUI/WindowRootControl.cs +++ b/Source/Engine/UI/GUI/WindowRootControl.cs @@ -340,15 +340,15 @@ namespace FlaxEngine.GUI } /// - 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); } } } diff --git a/Source/Tools/Flax.Build/Configuration.cs b/Source/Tools/Flax.Build/Configuration.cs index 79c1af75f..5cd643b8f 100644 --- a/Source/Tools/Flax.Build/Configuration.cs +++ b/Source/Tools/Flax.Build/Configuration.cs @@ -288,6 +288,7 @@ namespace Flax.Build [CommandLine("useLogInRelease", "Can be used to disable logging in Release game builds")] public static bool UseLogInRelease = true; + /// /// True if SDL support should be enabled. /// [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; + } } } } diff --git a/Source/Tools/Flax.Build/Deps/Dependencies/NvCloth.cs b/Source/Tools/Flax.Build/Deps/Dependencies/NvCloth.cs index 99fd3ff21..f3c3ff210 100644 --- a/Source/Tools/Flax.Build/Deps/Dependencies/NvCloth.cs +++ b/Source/Tools/Flax.Build/Deps/Dependencies/NvCloth.cs @@ -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[] diff --git a/Source/Tools/Flax.Build/Deps/Dependencies/SDL.cs b/Source/Tools/Flax.Build/Deps/Dependencies/SDL.cs index 704c527c5..7a16e7322 100644 --- a/Source/Tools/Flax.Build/Deps/Dependencies/SDL.cs +++ b/Source/Tools/Flax.Build/Deps/Dependencies/SDL.cs @@ -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 { /// - /// + /// 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. /// /// class SDL : Dependency diff --git a/Source/Tools/Flax.Build/Platforms/Mac/MacToolchain.cs b/Source/Tools/Flax.Build/Platforms/Mac/MacToolchain.cs index df42df310..25c540d2d 100644 --- a/Source/Tools/Flax.Build/Platforms/Mac/MacToolchain.cs +++ b/Source/Tools/Flax.Build/Platforms/Mac/MacToolchain.cs @@ -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 args) diff --git a/Source/Tools/Flax.Build/Platforms/Unix/UnixToolchain.cs b/Source/Tools/Flax.Build/Platforms/Unix/UnixToolchain.cs index 22f212e18..990219a89 100644 --- a/Source/Tools/Flax.Build/Platforms/Unix/UnixToolchain.cs +++ b/Source/Tools/Flax.Build/Platforms/Unix/UnixToolchain.cs @@ -411,7 +411,7 @@ namespace Flax.Build.Platforms // Use shared arguments args.Clear(); args.AddRange(commonArgs); - + // Language for the file args.Add("-x"); if (Path.GetExtension(sourceFile).Equals(".c", StringComparison.OrdinalIgnoreCase)) @@ -419,7 +419,7 @@ namespace Flax.Build.Platforms else { args.Add("c++"); - + // C++ version switch (compileEnvironment.CppVersion) {