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, "Major": 1,
"Minor": 12, "Minor": 12,
"Revision": 0, "Revision": 0,
"Build": 6904 "Build": 6905
}, },
"Company": "Flax", "Company": "Flax",
"Copyright": "Copyright (c) 2012-2026 Wojciech Figat. All rights reserved.", "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: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: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: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/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: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> <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; filesCount += files.Length;
foreach (var file in files) foreach (var file in files)
FindNewKeysCpp(file, newKeys, allKeys); 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; filesCount += files.Length;
foreach (var file in files) foreach (var file in files)
FindNewKeysCpp(file, newKeys, allKeys); FindNewKeysCpp(file, newKeys, allKeys);
@@ -279,7 +279,7 @@ namespace FlaxEditor.GUI.ContextMenu
_window.GotFocus += OnWindowGotFocus; _window.GotFocus += OnWindowGotFocus;
_window.LostFocus += OnWindowLostFocus; _window.LostFocus += OnWindowLostFocus;
} }
#if USE_IS_FOREGROUND && USE_SDL_WORKAROUNDS #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 // The focus between popup and parent windows doesn't change, force hide the popup when clicked on parent
parentWin.Window.MouseDown += OnWindowMouseDown; parentWin.Window.MouseDown += OnWindowMouseDown;
+1 -1
View File
@@ -50,7 +50,7 @@ namespace FlaxEditor.GUI.Docking
/// The mouse position. /// The mouse position.
/// </summary> /// </summary>
public Float2 MousePosition = Float2.Minimum; public Float2 MousePosition = Float2.Minimum;
/// <summary> /// <summary>
/// The mouse position. /// The mouse position.
/// </summary> /// </summary>
+1
View File
@@ -193,6 +193,7 @@ namespace FlaxEditor.GUI.Docking
{ {
CreateFloating(Float2.Zero, Float2.Zero); CreateFloating(Float2.Zero, Float2.Zero);
} }
/// <summary> /// <summary>
/// Creates the window in a floating state. /// Creates the window in a floating state.
/// </summary> /// </summary>
@@ -14,13 +14,13 @@ namespace FlaxEditor.GUI.Docking
private class FloatWindowDecorations : WindowDecorations private class FloatWindowDecorations : WindowDecorations
{ {
private FloatWindowDockPanel _panel; private FloatWindowDockPanel _panel;
public FloatWindowDecorations(FloatWindowDockPanel panel) public FloatWindowDecorations(FloatWindowDockPanel panel)
: base(panel.RootWindow) : base(panel.RootWindow)
{ {
_panel = panel; _panel = panel;
} }
/// <inheritdoc /> /// <inheritdoc />
public override bool OnMouseDown(Float2 location, MouseButton button) public override bool OnMouseDown(Float2 location, MouseButton button)
{ {
@@ -76,19 +76,19 @@ namespace FlaxEditor.GUI.Docking
Parent = window; Parent = window;
_window.Window.Closing += OnClosing; _window.Window.Closing += OnClosing;
_window.Window.LeftButtonHit += OnLeftButtonHit; _window.Window.LeftButtonHit += OnLeftButtonHit;
if (Utilities.Utils.UseCustomWindowDecorations()) if (Utilities.Utils.UseCustomWindowDecorations())
{ {
var decorations = Parent.AddChild(new FloatWindowDecorations(this)); var decorations = Parent.AddChild(new FloatWindowDecorations(this));
decorations.SetAnchorPreset(AnchorPresets.HorizontalStretchTop, false); decorations.SetAnchorPreset(AnchorPresets.HorizontalStretchTop, false);
} }
} }
/// <inheritdoc /> /// <inheritdoc />
protected override void PerformLayoutBeforeChildren() protected override void PerformLayoutBeforeChildren()
{ {
base.PerformLayoutBeforeChildren(); base.PerformLayoutBeforeChildren();
var decorations = Parent.GetChild<FloatWindowDecorations>(); var decorations = Parent.GetChild<FloatWindowDecorations>();
if (decorations != null) if (decorations != null)
{ {
@@ -143,7 +143,7 @@ namespace FlaxEditor.GUI.Docking
settings.ShowAfterFirstPaint = false; settings.ShowAfterFirstPaint = false;
settings.ShowInTaskbar = true; settings.ShowInTaskbar = true;
settings.StartPosition = startPosition; settings.StartPosition = startPosition;
if (Utilities.Utils.UseCustomWindowDecorations()) if (Utilities.Utils.UseCustomWindowDecorations())
{ {
settings.HasBorder = false; settings.HasBorder = false;
+2 -2
View File
@@ -322,7 +322,7 @@ namespace FlaxEditor.GUI.Input
#else #else
/// <inheritdoc /> /// <inheritdoc />
public override void OnMouseMoveRelative(Float2 mouseMotion) public override void OnMouseMoveRelative(Float2 motion)
{ {
var location = Root.TrackingMouseOffset; var location = Root.TrackingMouseOffset;
if (_isSliding) if (_isSliding)
@@ -344,7 +344,7 @@ namespace FlaxEditor.GUI.Input
_cursorChanged = false; _cursorChanged = false;
} }
base.OnMouseMoveRelative(mouseMotion); base.OnMouseMoveRelative(motion);
} }
#endif #endif
+14 -17
View File
@@ -1,8 +1,5 @@
// Copyright (c) Wojciech Figat. All rights reserved. // Copyright (c) Wojciech Figat. All rights reserved.
using System;
using FlaxEditor.GUI.Docking;
using FlaxEditor.Options;
using FlaxEngine; using FlaxEngine;
using FlaxEngine.GUI; using FlaxEngine.GUI;
@@ -26,12 +23,12 @@ public class WindowDecorations : ContainerControl
/// The title label in the title bar. /// The title label in the title bar.
/// </summary> /// </summary>
public Label Title => _title; public Label Title => _title;
/// <summary> /// <summary>
/// The icon used in the title bar. /// The icon used in the title bar.
/// </summary> /// </summary>
public Image Icon => _icon; public Image Icon => _icon;
/// <summary> /// <summary>
/// The tooltip shown when hovering over the icon. /// The tooltip shown when hovering over the icon.
/// </summary> /// </summary>
@@ -54,7 +51,7 @@ public class WindowDecorations : ContainerControl
: base(0, 0, 0, 20) : base(0, 0, 0, 20)
{ {
_window = window.RootWindow.Window; _window = window.RootWindow.Window;
AutoFocus = false; AutoFocus = false;
AnchorPreset = AnchorPresets.HorizontalStretchTop; AnchorPreset = AnchorPresets.HorizontalStretchTop;
BackgroundColor = Color.Transparent; BackgroundColor = Color.Transparent;
@@ -75,13 +72,13 @@ public class WindowDecorations : ContainerControl
{ {
_icon.Margin = new Margin(6, 6, 6, 6); _icon.Margin = new Margin(6, 6, 6, 6);
Height = 28; Height = 28;
_window.HitTest += OnHitTest; _window.HitTest += OnHitTest;
_window.Closed += OnWindowClosed; _window.Closed += OnWindowClosed;
FontAsset windowIconsFont = FlaxEngine.Content.LoadAsyncInternal<FontAsset>(EditorAssets.WindowIconsFont); FontAsset windowIconsFont = FlaxEngine.Content.LoadAsyncInternal<FontAsset>(EditorAssets.WindowIconsFont);
Font iconFont = windowIconsFont?.CreateFont(9); Font iconFont = windowIconsFont?.CreateFont(9);
_title = new Label(0, 0, Width, Height) _title = new Label(0, 0, Width, Height)
{ {
Text = _window.Title, Text = _window.Title,
@@ -150,7 +147,7 @@ public class WindowDecorations : ContainerControl
_charChromeMaximize = ((char)EditorAssets.SegMDL2Icons.ChromeMaximize).ToString(); _charChromeMaximize = ((char)EditorAssets.SegMDL2Icons.ChromeMaximize).ToString();
} }
} }
/// <inheritdoc /> /// <inheritdoc />
public override void Update(float deltaTime) public override void Update(float deltaTime)
{ {
@@ -216,20 +213,20 @@ public class WindowDecorations : ContainerControl
if (pos.Y > winSize.Y - distance) if (pos.Y > winSize.Y - distance)
return WindowHitCodes.Bottom; return WindowHitCodes.Bottom;
} }
var controlUnderMouse = GetChildAt(pos, control => control != _title); var controlUnderMouse = GetChildAt(pos, control => control != _title);
if (_title.Bounds.Contains(pos) && controlUnderMouse == null) if (_title.Bounds.Contains(pos) && controlUnderMouse == null)
return WindowHitCodes.Caption; return WindowHitCodes.Caption;
return WindowHitCodes.Client; return WindowHitCodes.Client;
} }
/// <inheritdoc /> /// <inheritdoc />
public override bool OnMouseDoubleClick(Float2 location, MouseButton button) public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
{ {
// These may not work with main window due to SDL not passing mouse events // These may not work with main window due to SDL not passing mouse events
// when interacting with hit tests on caption area... // when interacting with hit tests on caption area...
if (Title.Bounds.Contains(location) && button == MouseButton.Left) if (Title.Bounds.Contains(location) && button == MouseButton.Left)
{ {
if (_window.IsMaximized) if (_window.IsMaximized)
@@ -251,7 +248,7 @@ public class WindowDecorations : ContainerControl
{ {
// Calculate extents for title bounds area excluding the icon and main menu area // Calculate extents for title bounds area excluding the icon and main menu area
float x = 0; float x = 0;
// Icon // Icon
if (_icon != null) if (_icon != null)
{ {
@@ -273,7 +270,7 @@ public class WindowDecorations : ContainerControl
} }
} }
} }
// Buttons // Buttons
float rightMostButtonX = Width; float rightMostButtonX = Width;
if (_closeButton != null) if (_closeButton != null)
@@ -302,7 +299,7 @@ public class WindowDecorations : ContainerControl
_title.Bounds = new Rectangle(x, 0, rightMostButtonX - x, Height); _title.Bounds = new Rectangle(x, 0, rightMostButtonX - x, Height);
} }
} }
/// <inheritdoc /> /// <inheritdoc />
public override void Draw() public override void Draw()
{ {
@@ -321,7 +318,7 @@ public class WindowDecorations : ContainerControl
if (Editor.Instance.UI.StatusBar == null) if (Editor.Instance.UI.StatusBar == null)
return; return;
const float thickness = 1.0f; const float thickness = 1.0f;
Color color = Editor.Instance.UI.StatusBar.StatusColor; Color color = Editor.Instance.UI.StatusBar.StatusColor;
Rectangle rect = new Rectangle(thickness * 0.5f, thickness * 0.5f, Parent.Width - thickness, Parent.Height - thickness); Rectangle rect = new Rectangle(thickness * 0.5f, thickness * 0.5f, Parent.Width - thickness, Parent.Height - thickness);
+13 -13
View File
@@ -30,7 +30,7 @@ namespace FlaxEditor.Modules
{ {
private class MainWindowDecorations : WindowDecorations private class MainWindowDecorations : WindowDecorations
{ {
public MainWindowDecorations(RootControl window, bool iconOnly) public MainWindowDecorations(RootControl window, bool iconOnly)
: base(window, iconOnly) : base(window, iconOnly)
{ {
} }
@@ -45,7 +45,7 @@ namespace FlaxEditor.Modules
var editor = Editor.Instance; var editor = Editor.Instance;
return editor.Windows.EditWin.InputActions.Process(editor, this, key); return editor.Windows.EditWin.InputActions.Process(editor, this, key);
} }
/// <inheritdoc /> /// <inheritdoc />
public override void DrawBorders() public override void DrawBorders()
{ {
@@ -61,7 +61,7 @@ namespace FlaxEditor.Modules
Render2D.DrawLine(rect.UpperRight, rect.BottomRight, color); Render2D.DrawLine(rect.UpperRight, rect.BottomRight, color);
} }
} }
private struct Status private struct Status
{ {
public int ID; public int ID;
@@ -78,7 +78,7 @@ namespace FlaxEditor.Modules
private bool _progressFailed; private bool _progressFailed;
ContextMenuSingleSelectGroup<int> _numberOfClientsGroup = new ContextMenuSingleSelectGroup<int>(); ContextMenuSingleSelectGroup<int> _numberOfClientsGroup = new ContextMenuSingleSelectGroup<int>();
/// <summary> /// <summary>
/// Defines a viewport scaling option. /// Defines a viewport scaling option.
/// </summary> /// </summary>
@@ -99,7 +99,7 @@ namespace FlaxEditor.Modules
/// </summary> /// </summary>
Aspect = 1, Aspect = 1,
} }
/// <summary> /// <summary>
/// The name. /// The name.
/// </summary> /// </summary>
@@ -115,7 +115,7 @@ namespace FlaxEditor.Modules
/// </summary> /// </summary>
public Int2 Size; public Int2 Size;
} }
/// <summary> /// <summary>
/// The default viewport scaling options. /// The default viewport scaling options.
/// </summary> /// </summary>
@@ -486,7 +486,7 @@ namespace FlaxEditor.Modules
// Update window background // Update window background
mainWindow.BackgroundColor = Style.Current.Background; mainWindow.BackgroundColor = Style.Current.Background;
InitViewportScaleOptions(); InitViewportScaleOptions();
InitSharedMenus(); InitSharedMenus();
@@ -497,7 +497,7 @@ namespace FlaxEditor.Modules
InitWindowDecorations(mainWindow); InitWindowDecorations(mainWindow);
Editor.Options.OptionsChanged += OnOptionsChanged; Editor.Options.OptionsChanged += OnOptionsChanged;
mainWindow.PerformLayout(true); mainWindow.PerformLayout(true);
} }
@@ -536,7 +536,7 @@ namespace FlaxEditor.Modules
Size = new Int2(2560, 1440), Size = new Int2(2560, 1440),
}); });
} }
if (Editor.Instance.ProjectCache.TryGetCustomData("CustomViewportScalingOptions", out string data)) if (Editor.Instance.ProjectCache.TryGetCustomData("CustomViewportScalingOptions", out string data))
{ {
CustomViewportScaleOptions = JsonSerializer.Deserialize<List<ViewportScaleOption>>(data); CustomViewportScaleOptions = JsonSerializer.Deserialize<List<ViewportScaleOption>>(data);
@@ -549,7 +549,7 @@ namespace FlaxEditor.Modules
public void SaveCustomViewportScalingOptions() public void SaveCustomViewportScalingOptions()
{ {
var customOptions = JsonSerializer.Serialize(CustomViewportScaleOptions); var customOptions = JsonSerializer.Serialize(CustomViewportScaleOptions);
Editor.Instance.ProjectCache.SetCustomData("CustomViewportScalingOptions", customOptions); Editor.Instance.ProjectCache.SetCustomData("CustomViewportScalingOptions", customOptions);
} }
/// <inheritdoc /> /// <inheritdoc />
@@ -778,7 +778,7 @@ namespace FlaxEditor.Modules
MenuWindow = MainMenu.AddButton("Window"); MenuWindow = MainMenu.AddButton("Window");
cm = MenuWindow.ContextMenu; cm = MenuWindow.ContextMenu;
cm.VisibleChanged += OnMenuWindowVisibleChanged; 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("Scene", inputOptions.SceneWindow, Editor.Windows.SceneWin.FocusOrShow);
cm.AddButton("Toolbox", inputOptions.ToolboxWindow, Editor.Windows.ToolboxWin.FocusOrShow); cm.AddButton("Toolbox", inputOptions.ToolboxWindow, Editor.Windows.ToolboxWin.FocusOrShow);
cm.AddButton("Properties", inputOptions.PropertiesWindow, Editor.Windows.PropertiesWin.FocusOrShow); cm.AddButton("Properties", inputOptions.PropertiesWindow, Editor.Windows.PropertiesWin.FocusOrShow);
@@ -817,14 +817,14 @@ namespace FlaxEditor.Modules
var driver = Platform.DisplayServer; var driver = Platform.DisplayServer;
if (!string.IsNullOrEmpty(driver)) if (!string.IsNullOrEmpty(driver))
driver = $" ({driver})"; driver = $" ({driver})";
WindowDecorations = new MainWindowDecorations(mainWindow, !Utilities.Utils.UseCustomWindowDecorations(isMainWindow: true)) WindowDecorations = new MainWindowDecorations(mainWindow, !Utilities.Utils.UseCustomWindowDecorations(isMainWindow: true))
{ {
Parent = mainWindow, Parent = mainWindow,
IconTooltipText = $"{mainWindow.RootWindow.Title}\nVersion {Globals.EngineVersion}\nConfiguration {configuration}\nGraphics {GPUDevice.Instance.RendererType}{driver}", IconTooltipText = $"{mainWindow.RootWindow.Title}\nVersion {Globals.EngineVersion}\nConfiguration {configuration}\nGraphics {GPUDevice.Instance.RendererType}{driver}",
}; };
} }
private void OnOptionsChanged(EditorOptions options) private void OnOptionsChanged(EditorOptions options)
{ {
var inputOptions = options.Input; var inputOptions = options.Input;
+8 -6
View File
@@ -85,10 +85,12 @@ namespace FlaxEditor.Options
/// Never show the close button. /// Never show the close button.
/// </summary> /// </summary>
Never, Never,
/// <summary> /// <summary>
/// Show the close button on tabs that are currently selected. /// Show the close button on tabs that are currently selected.
/// </summary> /// </summary>
SelectedTab, SelectedTab,
/// <summary> /// <summary>
/// Show the close button on all tabs that can be closed. /// Show the close button on all tabs that can be closed.
/// </summary> /// </summary>
@@ -188,18 +190,18 @@ namespace FlaxEditor.Options
/// Determined automatically based on the system and any known compatibility issues with native decorations. /// Determined automatically based on the system and any known compatibility issues with native decorations.
/// </summary> /// </summary>
Auto, Auto,
/// <summary> /// <summary>
/// Automatically choose most compatible window decorations for child windows, prefer custom decorations on main window. /// Automatically choose most compatible window decorations for child windows, prefer custom decorations on main window.
/// </summary> /// </summary>
[EditorDisplay(Name = "Auto (Child Only)")] [EditorDisplay(Name = "Auto (Child Only)")]
AutoChildOnly, AutoChildOnly,
/// <summary> /// <summary>
/// Use native system window decorations on all windows. /// Use native system window decorations on all windows.
/// </summary> /// </summary>
Native, Native,
/// <summary> /// <summary>
/// Use custom client-side window decorations on all windows. /// Use custom client-side window decorations on all windows.
/// </summary> /// </summary>
@@ -322,7 +324,7 @@ namespace FlaxEditor.Options
#endif #endif
/// <summary> /// <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> /// </summary>
[DefaultValue(false)] [DefaultValue(false)]
[EditorDisplay("Tabs & Windows"), EditorOrder(99)] [EditorDisplay("Tabs & Windows"), EditorOrder(99)]
@@ -518,7 +520,7 @@ namespace FlaxEditor.Options
[DefaultValue(1), Range(1, 4)] [DefaultValue(1), Range(1, 4)]
[EditorDisplay("Cook & Run"), EditorOrder(600)] [EditorDisplay("Cook & Run"), EditorOrder(600)]
public int NumberOfGameClientsToLaunch = 1; public int NumberOfGameClientsToLaunch = 1;
/// <summary> /// <summary>
/// Gets or sets the build configuration to use when using Cook and Run option in the editor. /// Gets or sets the build configuration to use when using Cook and Run option in the editor.
/// </summary> /// </summary>
@@ -533,7 +535,7 @@ namespace FlaxEditor.Options
public float ConnectionCurvature { get; set; } = 1.0f; public float ConnectionCurvature { get; set; } = 1.0f;
/// <summary> /// <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> /// </summary>
[DefaultValue(true)] [DefaultValue(true)]
[EditorDisplay("Visject"), EditorOrder(550), Tooltip("Shows/hides the description panel in visual scripting context menu.")] [EditorDisplay("Visject"), EditorOrder(550), Tooltip("Shows/hides the description panel in visual scripting context menu.")]
@@ -2,4 +2,5 @@
#pragma once #pragma once
// [Deprecated in v1.12]
#include "Engine/Platform/ScreenUtilities.h" #include "Engine/Platform/ScreenUtilities.h"
+6
View File
@@ -1586,6 +1586,7 @@ namespace FlaxEditor.Utilities
internal static bool UseCustomWindowDecorations(bool isMainWindow = false) internal static bool UseCustomWindowDecorations(bool isMainWindow = false)
{ {
#if PLATFORM_SDL
return Editor.Instance.Options.Options.Interface.WindowDecorations switch return Editor.Instance.Options.Options.Interface.WindowDecorations switch
{ {
Options.InterfaceOptions.WindowDecorationsType.Auto => !Platform.SupportsNativeDecorations, Options.InterfaceOptions.WindowDecorationsType.Auto => !Platform.SupportsNativeDecorations,
@@ -1594,6 +1595,11 @@ namespace FlaxEditor.Utilities
Options.InterfaceOptions.WindowDecorationsType.ClientSide => true, Options.InterfaceOptions.WindowDecorationsType.ClientSide => true,
_ => throw new ArgumentOutOfRangeException() _ => throw new ArgumentOutOfRangeException()
}; };
#elif PLATFORM_WINDOWS
return !Editor.Instance.Options.Options.Interface.UseNativeWindowSystem;
#else
return false;
#endif
} }
internal static bool HideSingleTabWindowTabBars() internal static bool HideSingleTabWindowTabBars()
+2 -3
View File
@@ -1923,10 +1923,9 @@ namespace FlaxEditor.Viewport
_input.MouseWheelDelta = 0; _input.MouseWheelDelta = 0;
} }
/// <inheritdoc /> private void OnMouseMoveRelative(ref Float2 motion)
public void OnMouseMoveRelative(ref Float2 mouseMotion)
{ {
_mouseDelta += mouseMotion; _mouseDelta += motion;
} }
/// <inheritdoc /> /// <inheritdoc />
@@ -9,8 +9,6 @@
// Support more backbuffers in case driver decides to use more // Support more backbuffers in case driver decides to use more
#define VULKAN_BACK_BUFFERS_COUNT_MAX 8 #define VULKAN_BACK_BUFFERS_COUNT_MAX 8
class GPUDeviceVulkan;
/// <summary> /// <summary>
/// The implementation for the Vulkan API support for Android platform. /// The implementation for the Vulkan API support for Android platform.
/// </summary> /// </summary>
@@ -5,7 +5,6 @@
#include "LinuxVulkanPlatform.h" #include "LinuxVulkanPlatform.h"
#include "../RenderToolsVulkan.h" #include "../RenderToolsVulkan.h"
#include "Engine/Platform/Window.h" #include "Engine/Platform/Window.h"
#include "Engine/Platform/Linux/IncludeX11.h" #include "Engine/Platform/Linux/IncludeX11.h"
#define Display X11::Display #define Display X11::Display
#define Window X11::Window #define Window X11::Window
@@ -14,7 +13,6 @@
#undef Display #undef Display
#undef Window #undef Window
#undef VisualID #undef VisualID
#include "vulkan/vulkan_wayland.h" #include "vulkan/vulkan_wayland.h"
// Export extension from volk // Export extension from volk
@@ -12,8 +12,6 @@
// Prevent wierd error 'Invalid VkValidationCacheEXT Object' // Prevent wierd error 'Invalid VkValidationCacheEXT Object'
#define VULKAN_USE_VALIDATION_CACHE 0 #define VULKAN_USE_VALIDATION_CACHE 0
class GPUDeviceVulkan;
/// <summary> /// <summary>
/// The implementation for the Vulkan API support for Linux platform. /// The implementation for the Vulkan API support for Linux platform.
/// </summary> /// </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 // 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 #define VULKAN_USE_TIMER_QUERIES 0
class GPUDeviceVulkan;
/// <summary> /// <summary>
/// The implementation for the Vulkan API support for Mac platform. /// The implementation for the Vulkan API support for Mac platform.
/// </summary> /// </summary>
@@ -17,6 +17,8 @@ enum class VulkanValidationLevel
All = 5, All = 5,
}; };
class GPUDeviceVulkan;
/// <summary> /// <summary>
/// The base implementation for the Vulkan API platform support. /// The base implementation for the Vulkan API platform support.
/// </summary> /// </summary>
@@ -16,11 +16,10 @@ void Win32VulkanPlatform::GetInstanceExtensions(Array<const char*>& extensions,
void Win32VulkanPlatform::CreateSurface(Window* window, GPUDeviceVulkan* device, VkInstance instance, VkSurfaceKHR* surface) void Win32VulkanPlatform::CreateSurface(Window* window, GPUDeviceVulkan* device, VkInstance instance, VkSurfaceKHR* surface)
{ {
void* windowHandle = window->GetNativePtr();
VkWin32SurfaceCreateInfoKHR surfaceCreateInfo; VkWin32SurfaceCreateInfoKHR surfaceCreateInfo;
RenderToolsVulkan::ZeroStruct(surfaceCreateInfo, VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR); RenderToolsVulkan::ZeroStruct(surfaceCreateInfo, VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR);
surfaceCreateInfo.hinstance = GetModuleHandle(nullptr); 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)); VALIDATE_VULKAN_RESULT(vkCreateWin32SurfaceKHR(instance, &surfaceCreateInfo, nullptr, surface));
} }
@@ -10,8 +10,6 @@
#define VULKAN_USE_PLATFORM_WIN32_KHX 1 #define VULKAN_USE_PLATFORM_WIN32_KHX 1
#define VULKAN_USE_CREATE_WIN32_SURFACE 1 #define VULKAN_USE_CREATE_WIN32_SURFACE 1
class GPUDeviceVulkan;
/// <summary> /// <summary>
/// The implementation for the Vulkan API support for Win32 platform. /// The implementation for the Vulkan API support for Win32 platform.
/// </summary> /// </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 iOSVulkanPlatform::CreateSurface(Window* window, GPUDeviceVulkan* device, VkInstance instance, VkSurfaceKHR* surface)
{ {
void* windowHandle = window->GetNativePtr(); void* windowHandle = window->GetNativePtr();
// Create surface on a main UI Thread // Create surface on a main UI Thread
Function<void()> func = [&windowHandle, &instance, &surface]() 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 // 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 #define VULKAN_USE_TIMER_QUERIES 0
class GPUDeviceVulkan;
/// <summary> /// <summary>
/// The implementation for the Vulkan API support for iOS platform. /// The implementation for the Vulkan API support for iOS platform.
/// </summary> /// </summary>
+1 -1
View File
@@ -117,7 +117,7 @@ public:
} }
/// <summary> /// <summary>
/// Gets the current state of mouse relative mode. /// Gets the current state of mouse relative mode.
/// </summary> /// </summary>
/// <param name="window">The window to check against, or null to check for any window.</param> /// <param name="window">The window to check against, or null to check for any window.</param>
/// <returns>True if mouse is in relative mode, otherwise false.</returns> /// <returns>True if mouse is in relative mode, otherwise false.</returns>
@@ -599,6 +599,11 @@ void WindowBase::Close(ClosingReason reason)
OnClosed(); OnClosed();
} }
bool WindowBase::IsClosed() const
{
return _isClosing || EnumHasAnyFlags(Flags, ObjectFlags::WasMarkedToDelete);
}
bool WindowBase::IsForegroundWindow() const bool WindowBase::IsForegroundWindow() const
{ {
return _focused; return _focused;
+1 -4
View File
@@ -242,10 +242,7 @@ public:
/// <summary> /// <summary>
/// Checks if window is closed. /// Checks if window is closed.
/// </summary> /// </summary>
API_PROPERTY() virtual bool IsClosed() const API_PROPERTY() virtual bool IsClosed() const;
{
return _isClosing;
}
/// <summary> /// <summary>
/// Checks if window is foreground (the window with which the user is currently working). /// Checks if window is foreground (the window with which the user is currently working).
@@ -146,6 +146,7 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(CreateWindowSettings);
/// <summary> /// <summary>
/// True if it's a regular window, false for tooltips, context menu and other utility windows. /// True if it's a regular window, false for tooltips, context menu and other utility windows.
/// [Deprecated in v1.12]
/// </summary> /// </summary>
API_FIELD() DEPRECATED("Use Type instead") bool IsRegularWindow = true; API_FIELD() DEPRECATED("Use Type instead") bool IsRegularWindow = true;
@@ -374,11 +374,6 @@ void LinuxWindow::BringToFront(bool force)
X11::XFlush(display); X11::XFlush(display);
} }
bool LinuxWindow::IsClosed() const
{
return _isClosing;
}
bool LinuxWindow::IsForegroundWindow() const bool LinuxWindow::IsForegroundWindow() const
{ {
return _focused || _focusOnMapped; return _focused || _focusOnMapped;
@@ -72,7 +72,6 @@ public:
void Minimize() override; void Minimize() override;
void Maximize() override; void Maximize() override;
void Restore() override; void Restore() override;
bool IsClosed() const override;
bool IsForegroundWindow() const override; bool IsForegroundWindow() const override;
void BringToFront(bool force = false) override; void BringToFront(bool force = false) override;
void SetClientBounds(const Rectangle& clientArea) override; void SetClientBounds(const Rectangle& clientArea) override;
-5
View File
@@ -364,11 +364,6 @@ void UWPWindow::Restore()
// Not supported // Not supported
} }
bool UWPWindow::IsClosed() const
{
return _isClosing;
}
void UWPWindow::BringToFront(bool force) void UWPWindow::BringToFront(bool force)
{ {
Focus(); Focus();
-1
View File
@@ -160,7 +160,6 @@ public:
void Minimize() override; void Minimize() override;
void Maximize() override; void Maximize() override;
void Restore() override; void Restore() override;
bool IsClosed() const override;
void BringToFront(bool force = false) override; void BringToFront(bool force = false) override;
void SetClientBounds(const Rectangle& clientArea) override; void SetClientBounds(const Rectangle& clientArea) override;
void SetPosition(const Float2& position) override; void SetPosition(const Float2& position) override;
+6 -6
View File
@@ -34,12 +34,12 @@ namespace FlaxEngine
/// </summary> /// </summary>
/// <param name="mousePosition">The mouse position.</param> /// <param name="mousePosition">The mouse position.</param>
public delegate void MouseMoveDelegate(ref Float2 mousePosition); public delegate void MouseMoveDelegate(ref Float2 mousePosition);
/// <summary> /// <summary>
/// Perform mouse move action in relative mode. /// Perform mouse move action in relative mode.
/// </summary> /// </summary>
/// <param name="mouseMotion">The relative mouse motion.</param> /// <param name="motion">The relative mouse motion.</param>
public delegate void MouseMoveRelativeDelegate(ref Float2 mouseMotion); public delegate void MouseMoveRelativeDelegate(ref Float2 motion);
/// <summary> /// <summary>
/// Perform mouse wheel action. /// Perform mouse wheel action.
@@ -285,10 +285,10 @@ namespace FlaxEngine
GUI.OnMouseMove(pos); GUI.OnMouseMove(pos);
} }
internal void Internal_OnMouseMoveRelative(ref Float2 mouseMotion) internal void Internal_OnMouseMoveRelative(ref Float2 motion)
{ {
MouseMoveRelative?.Invoke(ref mouseMotion); MouseMoveRelative?.Invoke(ref motion);
GUI.OnMouseMoveRelative(mouseMotion); GUI.OnMouseMoveRelative(motion);
} }
internal void Internal_OnMouseLeave() internal void Internal_OnMouseLeave()
@@ -352,7 +352,7 @@ void WindowsWindow::Restore()
bool WindowsWindow::IsClosed() const bool WindowsWindow::IsClosed() const
{ {
return !HasHWND(); return !HasHWND() || EnumHasAnyFlags(Flags, ObjectFlags::WasMarkedToDelete);
} }
bool WindowsWindow::IsForegroundWindow() const bool WindowsWindow::IsForegroundWindow() const
+3 -3
View File
@@ -773,13 +773,13 @@ namespace FlaxEngine.GUI
Tooltip?.OnMouseLeaveControl(this); Tooltip?.OnMouseLeaveControl(this);
} }
} }
/// <summary> /// <summary>
/// When mouse moves over control's area while mouse is in relative mode /// When mouse moves over control's area while mouse is in relative mode
/// </summary> /// </summary>
/// <param name="mouseMotion">Mouse relative motion</param> /// <param name="motion">Mouse relative motion</param>
[NoAnimate] [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; var rightBottomLocationSS = locationSS + dpiSize;
// Prioritize tooltip placement within parent window, fall back to virtual desktop // Prioritize tooltip placement within parent window, fall back to virtual desktop
/*if (rightBottomMonitorBounds.Y < rightBottomLocationSS.Y) if (rightBottomMonitorBounds.Y < rightBottomLocationSS.Y)
{ {
// Direction: up // Direction: up
locationSS.Y -= dpiSize.Y + flipOffset; locationSS.Y -= dpiSize.Y + flipOffset;
@@ -222,7 +222,7 @@ namespace FlaxEngine.GUI
{ {
// Direction: left // Direction: left
locationSS.X -= dpiSize.X + flipOffset * 2; locationSS.X -= dpiSize.X + flipOffset * 2;
}*/ }
} }
/// <inheritdoc /> /// <inheritdoc />
+3 -3
View File
@@ -340,15 +340,15 @@ namespace FlaxEngine.GUI
} }
/// <inheritdoc /> /// <inheritdoc />
public override void OnMouseMoveRelative(Float2 mouseMotion) public override void OnMouseMoveRelative(Float2 motion)
{ {
if (_trackingControl != null) if (_trackingControl != null)
{ {
_trackingControl.OnMouseMoveRelative(mouseMotion); _trackingControl.OnMouseMoveRelative(motion);
return; 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")] [CommandLine("useLogInRelease", "Can be used to disable logging in Release game builds")]
public static bool UseLogInRelease = true; public static bool UseLogInRelease = true;
/// <summary>
/// True if SDL support should be enabled. /// True if SDL support should be enabled.
/// </summary> /// </summary>
[CommandLine("useSdl", "1 to enable SDL support in build")] [CommandLine("useSdl", "1 to enable SDL support in build")]
@@ -311,10 +312,14 @@ namespace Flax.Build
public static bool WithSDL(NativeCpp.BuildOptions options) public static bool WithSDL(NativeCpp.BuildOptions options)
{ {
bool supportedPlatform = options.Platform.Target == TargetPlatform.Windows || switch (options.Platform.Target)
options.Platform.Target == TargetPlatform.Linux || {
options.Platform.Target == TargetPlatform.Mac; case TargetPlatform.Windows:
return UseSDL && supportedPlatform; 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); RunCmake(cmakeFolder, platform, architecture, " -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF " + cmakeArgs, envVars);
// Run build // Run build
BuildCmake(cmakeFolder, envVars: envVars); BuildCmake(cmakeFolder, envVars);
// Deploy binaries // Deploy binaries
var libs = new[] var libs = new[]
@@ -3,15 +3,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.IO.Compression;
using System.Linq;
using Flax.Build; using Flax.Build;
using Flax.Build.Platforms;
namespace Flax.Deps.Dependencies namespace Flax.Deps.Dependencies
{ {
/// <summary> /// <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> /// </summary>
/// <seealso cref="Flax.Deps.Dependency" /> /// <seealso cref="Flax.Deps.Dependency" />
class SDL : Dependency class SDL : Dependency
@@ -53,13 +53,16 @@ namespace Flax.Build.Platforms
options.LinkEnv.InputLibraries.Add("QuartzCore.framework"); options.LinkEnv.InputLibraries.Add("QuartzCore.framework");
options.LinkEnv.InputLibraries.Add("AVFoundation.framework"); options.LinkEnv.InputLibraries.Add("AVFoundation.framework");
// SDL3 requires the following frameworks: if (EngineConfiguration.WithSDL(options))
options.LinkEnv.InputLibraries.Add("Foundation.framework"); {
options.LinkEnv.InputLibraries.Add("GameController.framework"); // SDL3 requires the following frameworks:
options.LinkEnv.InputLibraries.Add("Carbon.framework"); options.LinkEnv.InputLibraries.Add("Foundation.framework");
options.LinkEnv.InputLibraries.Add("ForceFeedback.framework"); options.LinkEnv.InputLibraries.Add("GameController.framework");
options.LinkEnv.InputLibraries.Add("UniformTypeIdentifiers.framework"); options.LinkEnv.InputLibraries.Add("Carbon.framework");
options.LinkEnv.InputLibraries.Add("CoreHaptics.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) protected override void AddArgsCommon(BuildOptions options, List<string> args)
@@ -411,7 +411,7 @@ namespace Flax.Build.Platforms
// Use shared arguments // Use shared arguments
args.Clear(); args.Clear();
args.AddRange(commonArgs); args.AddRange(commonArgs);
// Language for the file // Language for the file
args.Add("-x"); args.Add("-x");
if (Path.GetExtension(sourceFile).Equals(".c", StringComparison.OrdinalIgnoreCase)) if (Path.GetExtension(sourceFile).Equals(".c", StringComparison.OrdinalIgnoreCase))
@@ -419,7 +419,7 @@ namespace Flax.Build.Platforms
else else
{ {
args.Add("c++"); args.Add("c++");
// C++ version // C++ version
switch (compileEnvironment.CppVersion) switch (compileEnvironment.CppVersion)
{ {