From 37c8aacd8b2d17ba1864ddadf77461e5ff370506 Mon Sep 17 00:00:00 2001 From: Ruan Lucas <79365912+RuanLucasGD@users.noreply.github.com> Date: Fri, 14 Oct 2022 15:20:57 -0400 Subject: [PATCH 1/5] Fix math node size --- Source/Editor/Surface/Archetypes/Math.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Editor/Surface/Archetypes/Math.cs b/Source/Editor/Surface/Archetypes/Math.cs index 4518a3090..caedbdc2a 100644 --- a/Source/Editor/Surface/Archetypes/Math.cs +++ b/Source/Editor/Surface/Archetypes/Math.cs @@ -47,7 +47,7 @@ namespace FlaxEditor.Surface.Archetypes Description = desc, Flags = NodeFlags.AllGraphs, AlternativeTitles = altTitles, - Size = new Float2(110, 40), + Size = new Float2(140, 40), DefaultType = new ScriptType(inputType), ConnectionsHints = hints, IndependentBoxes = new[] { 0, 1 }, From a65e812b45b98523519723ce6f1c9c633f75460b Mon Sep 17 00:00:00 2001 From: Ruan Lucas <79365912+RuanLucasGD@users.noreply.github.com> Date: Thu, 20 Oct 2022 19:57:23 -0400 Subject: [PATCH 2/5] Add method that returns a list of standard monitor resolutions --- Source/Engine/Engine/Screen.cpp | 98 +++++++++++++++++++++++++++++++++ Source/Engine/Engine/Screen.h | 7 +++ 2 files changed, 105 insertions(+) diff --git a/Source/Engine/Engine/Screen.cpp b/Source/Engine/Engine/Screen.cpp index b6cec67c6..1a424009d 100644 --- a/Source/Engine/Engine/Screen.cpp +++ b/Source/Engine/Engine/Screen.cpp @@ -66,6 +66,104 @@ void Screen::SetSize(const Float2& value) Size = value; } +Array Screen::GetAllResolutions() { + + // reference: https://en.wikipedia.org/wiki/List_of_common_resolutions + + // all list of monitors and video resolutions + Float2 rawResolutions[66] = { + Float2(480, 480), + Float2(528, 480), + Float2(544, 576), + Float2(544, 480), + Float2(640, 480), + Float2(704, 480), + Float2(704, 576), + Float2(720, 480), + Float2(720, 486), + Float2(720, 576), + Float2(768, 480), + Float2(800, 480), + Float2(800, 600), + Float2(960, 720), + Float2(1024, 600), + Float2(1024, 768), + Float2(1024, 1024), + Float2(1280, 720), + Float2(1280, 800), + Float2(1280, 1024), + Float2(1280, 1080), + Float2(1366, 768), + Float2(1440, 900), + Float2(1440, 1024), + Float2(1440, 1080), + Float2(1600, 900), + Float2(1600, 1024), + Float2(1600, 1200), + Float2(1680, 1050), + Float2(1828, 1332), + Float2(1920, 1080), + Float2(1920, 1400), + Float2(1920, 1440), + Float2(1990, 1080), + Float2(2048, 858), + Float2(2048, 1080), + Float2(2048, 1280), + Float2(2048, 1440), + Float2(2048, 1536), + Float2(2304, 1728), + Float2(2400, 1080), + Float2(2560, 1080), + Float2(2560, 1440), + Float2(2560, 1600), + Float2(2800, 2100), + Float2(3840, 2160), + Float2(2048, 1556), + Float2(3000, 2000), + Float2(3240, 2160), + Float2(3840, 2160), + Float2(4096, 1714), + Float2(4096, 2304), + Float2(5120, 2160), + Float2(5120, 2880), + Float2(5120, 1440), + Float2(5120, 3200), + Float2(6012, 3384), + Float2(7200, 3600), + Float2(7680, 4320), + Float2(7680, 4320), + Float2(8192, 4320), + Float2(10240, 4320), + Float2(15360, 8640) + }; + + Float2 primaryResolution = Platform::GetDesktopSize(); + Array resolutions = Array(); + + // invert horizontal resolutions to vertical + if (primaryResolution.Y > primaryResolution.X) + { + for (int i = 0; i < rawResolutions->Length(); i++) + { + rawResolutions[i] = Float2(rawResolutions[i].Y, rawResolutions[i].Y); + } + } + + for each (Float2 r in rawResolutions) + { + if (r.X >= primaryResolution.X && r.Y >= primaryResolution.Y) + { + break; + } + + resolutions.Add(r); + } + + resolutions.Add(primaryResolution); + + return resolutions; +} + Float2 Screen::ScreenToGameViewport(const Float2& screenPos) { #if USE_EDITOR diff --git a/Source/Engine/Engine/Screen.h b/Source/Engine/Engine/Screen.h index 7f0f4ff6d..8c349aef2 100644 --- a/Source/Engine/Engine/Screen.h +++ b/Source/Engine/Engine/Screen.h @@ -5,6 +5,7 @@ #include "Engine/Scripting/ScriptingType.h" #include "Engine/Input/Enums.h" #include "Engine/Core/Math/Vector2.h" +#include "Engine/Core/Collections/Array.h" /// /// Helper class to access display information. @@ -34,6 +35,12 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(Screen); /// The value API_PROPERTY() static Float2 GetSize(); + /// + /// returns a list of standard resolutions used in monitors and media + /// + /// List of resolutions + API_PROPERTY() static Array GetAllResolutions(); + /// /// Converts the screen-space position to the game viewport position. /// From a4333dfcb6dc8c72f5f1454a511a937391fafdbe Mon Sep 17 00:00:00 2001 From: Ruan Lucas <79365912+RuanLucasGD@users.noreply.github.com> Date: Thu, 20 Oct 2022 20:26:08 -0400 Subject: [PATCH 3/5] add flag to work for desktop and linux only --- Source/Engine/Engine/Screen.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/Engine/Engine/Screen.cpp b/Source/Engine/Engine/Screen.cpp index 1a424009d..462110100 100644 --- a/Source/Engine/Engine/Screen.cpp +++ b/Source/Engine/Engine/Screen.cpp @@ -69,7 +69,7 @@ void Screen::SetSize(const Float2& value) Array Screen::GetAllResolutions() { // reference: https://en.wikipedia.org/wiki/List_of_common_resolutions - +#if PLATFORM_DESKTOP || PLATFORM_LINUX // all list of monitors and video resolutions Float2 rawResolutions[66] = { Float2(480, 480), @@ -141,7 +141,7 @@ Array Screen::GetAllResolutions() { Array resolutions = Array(); // invert horizontal resolutions to vertical - if (primaryResolution.Y > primaryResolution.X) + if (primaryResolution.Y > primaryResolution.X) { for (int i = 0; i < rawResolutions->Length(); i++) { @@ -160,8 +160,10 @@ Array Screen::GetAllResolutions() { } resolutions.Add(primaryResolution); - return resolutions; +#else + return Array({ primaryResolution }); +#endif } Float2 Screen::ScreenToGameViewport(const Float2& screenPos) From e1dc5a2e81ac7911a48bc46b836eaf5580fb381a Mon Sep 17 00:00:00 2001 From: Ruan Lucas <79365912+RuanLucasGD@users.noreply.github.com> Date: Thu, 20 Oct 2022 20:47:02 -0400 Subject: [PATCH 4/5] remove incorrect method --- Source/Engine/Engine/Screen.cpp | 100 -------------------------------- Source/Engine/Engine/Screen.h | 6 -- 2 files changed, 106 deletions(-) diff --git a/Source/Engine/Engine/Screen.cpp b/Source/Engine/Engine/Screen.cpp index 462110100..b6cec67c6 100644 --- a/Source/Engine/Engine/Screen.cpp +++ b/Source/Engine/Engine/Screen.cpp @@ -66,106 +66,6 @@ void Screen::SetSize(const Float2& value) Size = value; } -Array Screen::GetAllResolutions() { - - // reference: https://en.wikipedia.org/wiki/List_of_common_resolutions -#if PLATFORM_DESKTOP || PLATFORM_LINUX - // all list of monitors and video resolutions - Float2 rawResolutions[66] = { - Float2(480, 480), - Float2(528, 480), - Float2(544, 576), - Float2(544, 480), - Float2(640, 480), - Float2(704, 480), - Float2(704, 576), - Float2(720, 480), - Float2(720, 486), - Float2(720, 576), - Float2(768, 480), - Float2(800, 480), - Float2(800, 600), - Float2(960, 720), - Float2(1024, 600), - Float2(1024, 768), - Float2(1024, 1024), - Float2(1280, 720), - Float2(1280, 800), - Float2(1280, 1024), - Float2(1280, 1080), - Float2(1366, 768), - Float2(1440, 900), - Float2(1440, 1024), - Float2(1440, 1080), - Float2(1600, 900), - Float2(1600, 1024), - Float2(1600, 1200), - Float2(1680, 1050), - Float2(1828, 1332), - Float2(1920, 1080), - Float2(1920, 1400), - Float2(1920, 1440), - Float2(1990, 1080), - Float2(2048, 858), - Float2(2048, 1080), - Float2(2048, 1280), - Float2(2048, 1440), - Float2(2048, 1536), - Float2(2304, 1728), - Float2(2400, 1080), - Float2(2560, 1080), - Float2(2560, 1440), - Float2(2560, 1600), - Float2(2800, 2100), - Float2(3840, 2160), - Float2(2048, 1556), - Float2(3000, 2000), - Float2(3240, 2160), - Float2(3840, 2160), - Float2(4096, 1714), - Float2(4096, 2304), - Float2(5120, 2160), - Float2(5120, 2880), - Float2(5120, 1440), - Float2(5120, 3200), - Float2(6012, 3384), - Float2(7200, 3600), - Float2(7680, 4320), - Float2(7680, 4320), - Float2(8192, 4320), - Float2(10240, 4320), - Float2(15360, 8640) - }; - - Float2 primaryResolution = Platform::GetDesktopSize(); - Array resolutions = Array(); - - // invert horizontal resolutions to vertical - if (primaryResolution.Y > primaryResolution.X) - { - for (int i = 0; i < rawResolutions->Length(); i++) - { - rawResolutions[i] = Float2(rawResolutions[i].Y, rawResolutions[i].Y); - } - } - - for each (Float2 r in rawResolutions) - { - if (r.X >= primaryResolution.X && r.Y >= primaryResolution.Y) - { - break; - } - - resolutions.Add(r); - } - - resolutions.Add(primaryResolution); - return resolutions; -#else - return Array({ primaryResolution }); -#endif -} - Float2 Screen::ScreenToGameViewport(const Float2& screenPos) { #if USE_EDITOR diff --git a/Source/Engine/Engine/Screen.h b/Source/Engine/Engine/Screen.h index 8c349aef2..e9dbe9279 100644 --- a/Source/Engine/Engine/Screen.h +++ b/Source/Engine/Engine/Screen.h @@ -35,12 +35,6 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(Screen); /// The value API_PROPERTY() static Float2 GetSize(); - /// - /// returns a list of standard resolutions used in monitors and media - /// - /// List of resolutions - API_PROPERTY() static Array GetAllResolutions(); - /// /// Converts the screen-space position to the game viewport position. /// From ca49454615b1bb1f9a9c6e6a32aa3b30027cda1a Mon Sep 17 00:00:00 2001 From: Ruan Lucas <79365912+RuanLucasGD@users.noreply.github.com> Date: Thu, 20 Oct 2022 20:49:37 -0400 Subject: [PATCH 5/5] remove unused include --- Source/Engine/Engine/Screen.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/Engine/Engine/Screen.h b/Source/Engine/Engine/Screen.h index e9dbe9279..7f0f4ff6d 100644 --- a/Source/Engine/Engine/Screen.h +++ b/Source/Engine/Engine/Screen.h @@ -5,7 +5,6 @@ #include "Engine/Scripting/ScriptingType.h" #include "Engine/Input/Enums.h" #include "Engine/Core/Math/Vector2.h" -#include "Engine/Core/Collections/Array.h" /// /// Helper class to access display information.