From a5ac086364b3fab81a994e935bdea613a6b42935 Mon Sep 17 00:00:00 2001 From: N00MKRAD <61149547+n00mkrad@users.noreply.github.com> Date: Wed, 16 Oct 2024 10:26:05 +0200 Subject: [PATCH] Make SplashForm more flexible, cleanup --- CodeLegacy/Cli.cs | 4 ---- CodeLegacy/Forms/Main/Form1.cs | 3 ++- CodeLegacy/Forms/SplashForm.Designer.cs | 30 ++++++++++++------------- CodeLegacy/Forms/SplashForm.cs | 11 ++++++++- CodeLegacy/Os/VulkanUtils.cs | 2 +- 5 files changed, 28 insertions(+), 22 deletions(-) diff --git a/CodeLegacy/Cli.cs b/CodeLegacy/Cli.cs index 18ee0aa..f3af52a 100644 --- a/CodeLegacy/Cli.cs +++ b/CodeLegacy/Cli.cs @@ -43,10 +43,6 @@ namespace Flowframes var optsSet = new OptionSet { - // { - // "c|console", "Show console", - // v => ShowConsole = v != null - // }, { "np|no_python", "Disable Python implementations", v => DisablePython = v != null diff --git a/CodeLegacy/Forms/Main/Form1.cs b/CodeLegacy/Forms/Main/Form1.cs index 8a93558..f5498a0 100644 --- a/CodeLegacy/Forms/Main/Form1.cs +++ b/CodeLegacy/Forms/Main/Form1.cs @@ -52,7 +52,8 @@ namespace Flowframes.Forms.Main { InitializeComponent(); - new SplashForm().Show(); + var splash = new SplashForm("Starting Flowframes..."); + splash.Show(); if (Program.CmdMode) { diff --git a/CodeLegacy/Forms/SplashForm.Designer.cs b/CodeLegacy/Forms/SplashForm.Designer.cs index 311d3a2..b96982b 100644 --- a/CodeLegacy/Forms/SplashForm.Designer.cs +++ b/CodeLegacy/Forms/SplashForm.Designer.cs @@ -28,22 +28,22 @@ /// private void InitializeComponent() { - this.loadingTextLabel = new System.Windows.Forms.Label(); + this.statusLabel = new System.Windows.Forms.Label(); this.SuspendLayout(); // - // loadingTextLabel + // statusLabel // - this.loadingTextLabel.Dock = System.Windows.Forms.DockStyle.Fill; - this.loadingTextLabel.Font = new System.Drawing.Font("Yu Gothic UI", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.loadingTextLabel.ForeColor = System.Drawing.Color.White; - this.loadingTextLabel.Location = new System.Drawing.Point(0, 0); - this.loadingTextLabel.Margin = new System.Windows.Forms.Padding(3, 0, 3, 10); - this.loadingTextLabel.Name = "loadingTextLabel"; - this.loadingTextLabel.Size = new System.Drawing.Size(480, 220); - this.loadingTextLabel.TabIndex = 2; - this.loadingTextLabel.Text = "Starting Flowframes..."; - this.loadingTextLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.loadingTextLabel.UseWaitCursor = true; + this.statusLabel.Dock = System.Windows.Forms.DockStyle.Fill; + this.statusLabel.Font = new System.Drawing.Font("Yu Gothic UI", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.statusLabel.ForeColor = System.Drawing.Color.White; + this.statusLabel.Location = new System.Drawing.Point(0, 0); + this.statusLabel.Margin = new System.Windows.Forms.Padding(3, 0, 3, 10); + this.statusLabel.Name = "statusLabel"; + this.statusLabel.Size = new System.Drawing.Size(480, 220); + this.statusLabel.TabIndex = 2; + this.statusLabel.Text = "Starting Flowframes..."; + this.statusLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.statusLabel.UseWaitCursor = true; // // SplashForm // @@ -51,7 +51,7 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(32)))), ((int)(((byte)(32))))); this.ClientSize = new System.Drawing.Size(480, 220); - this.Controls.Add(this.loadingTextLabel); + this.Controls.Add(this.statusLabel); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.MaximizeBox = false; this.MaximumSize = new System.Drawing.Size(480, 220); @@ -72,6 +72,6 @@ #endregion - private System.Windows.Forms.Label loadingTextLabel; + public System.Windows.Forms.Label statusLabel; } } \ No newline at end of file diff --git a/CodeLegacy/Forms/SplashForm.cs b/CodeLegacy/Forms/SplashForm.cs index 8b4be5b..6a131c7 100644 --- a/CodeLegacy/Forms/SplashForm.cs +++ b/CodeLegacy/Forms/SplashForm.cs @@ -4,9 +4,13 @@ namespace Flowframes.Forms { public partial class SplashForm : Form { - public SplashForm() + public static SplashForm Inst; + + public SplashForm(string status = "") { + Inst = this; InitializeComponent(); + SetStatus(status); } private void SplashForm_Load(object sender, System.EventArgs e) @@ -16,5 +20,10 @@ namespace Flowframes.Forms Opacity = 1f; } } + + public void SetStatus(string status) + { + statusLabel.Text = status; + } } } diff --git a/CodeLegacy/Os/VulkanUtils.cs b/CodeLegacy/Os/VulkanUtils.cs index 7aba809..14e055f 100644 --- a/CodeLegacy/Os/VulkanUtils.cs +++ b/CodeLegacy/Os/VulkanUtils.cs @@ -43,7 +43,7 @@ namespace Flowframes.Os string name = device.GetProperties().DeviceName; VkDevices.Add(new VkDevice { Id = idx, Name = name, ComputeQueueCount = compQueues }); - Logger.Log($"[VK] Found Vulkan device: {VkDevices.Last()} ({compQueues} Compute Queues)", true); + Logger.Log($"[VK] Found Vulkan device: {VkDevices.Last()}", true); } // Clean up Vulkan resources