From 58fe098ce91b10a6b10b7987080dd4503b2d8cbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hein=20Andre=20Gr=C3=B8nnestad?= Date: Thu, 19 Sep 2019 00:25:51 +0200 Subject: [PATCH] #12 Added StatusStrip and FPS label --- .../Commodore64/FormC64Screen.Designer.cs | 24 +++++++++++++++++++ ComputerSystems/Commodore64/FormC64Screen.cs | 3 +-- .../Commodore64/FormC64Screen.resx | 5 +++- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/ComputerSystems/Commodore64/FormC64Screen.Designer.cs b/ComputerSystems/Commodore64/FormC64Screen.Designer.cs index 16aa79f..ecbda7a 100644 --- a/ComputerSystems/Commodore64/FormC64Screen.Designer.cs +++ b/ComputerSystems/Commodore64/FormC64Screen.Designer.cs @@ -27,8 +27,11 @@ private void InitializeComponent() { this.mnuSystem = new System.Windows.Forms.ToolStripMenuItem(); this.mnuReset = new System.Windows.Forms.ToolStripMenuItem(); this.pScreen = new System.Windows.Forms.PictureBox(); + this.statusMain = new System.Windows.Forms.StatusStrip(); + this.lblFps = new System.Windows.Forms.ToolStripStatusLabel(); this.mnuMain.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pScreen)).BeginInit(); + this.statusMain.SuspendLayout(); this.SuspendLayout(); // // mnuMain @@ -66,11 +69,28 @@ private void InitializeComponent() { this.pScreen.TabStop = false; this.pScreen.Paint += new System.Windows.Forms.PaintEventHandler(this.PScreen_Paint); // + // statusMain + // + this.statusMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.lblFps}); + this.statusMain.Location = new System.Drawing.Point(0, 443); + this.statusMain.Name = "statusMain"; + this.statusMain.Size = new System.Drawing.Size(656, 22); + this.statusMain.TabIndex = 2; + this.statusMain.Text = "statusStrip1"; + // + // lblFps + // + this.lblFps.Name = "lblFps"; + this.lblFps.Size = new System.Drawing.Size(32, 17); + this.lblFps.Text = "0 fps"; + // // FormC64Screen // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(656, 465); + this.Controls.Add(this.statusMain); this.Controls.Add(this.pScreen); this.Controls.Add(this.mnuMain); this.DoubleBuffered = true; @@ -83,6 +103,8 @@ private void InitializeComponent() { this.mnuMain.ResumeLayout(false); this.mnuMain.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pScreen)).EndInit(); + this.statusMain.ResumeLayout(false); + this.statusMain.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -94,5 +116,7 @@ private void InitializeComponent() { private System.Windows.Forms.ToolStripMenuItem mnuSystem; private System.Windows.Forms.ToolStripMenuItem mnuReset; private System.Windows.Forms.PictureBox pScreen; + private System.Windows.Forms.StatusStrip statusMain; + private System.Windows.Forms.ToolStripStatusLabel lblFps; } } \ No newline at end of file diff --git a/ComputerSystems/Commodore64/FormC64Screen.cs b/ComputerSystems/Commodore64/FormC64Screen.cs index b33a9fb..4a7ba9b 100644 --- a/ComputerSystems/Commodore64/FormC64Screen.cs +++ b/ComputerSystems/Commodore64/FormC64Screen.cs @@ -133,7 +133,6 @@ private void MnuReset_Click(object sender, EventArgs e) { private void PScreen_Paint(object sender, PaintEventArgs e) { if (C64.Cpu.Memory[C64MemoryLocations.CURRENT_OUTPUT_DEVICE] != C64MemoryValues.CURRENT_OUTPUT_DEVICE_SCREEN) { - Text = "Screen disabled!"; return; } @@ -155,7 +154,7 @@ private void PScreen_Paint(object sender, PaintEventArgs e) { _stopWatch.Stop(); _fpsActual = 1000f / _stopWatch.Elapsed.TotalMilliseconds; - Text = $"{_fpsActual:F1} fps"; + lblFps.Text = $"{_fpsActual:F1} fps"; _stopWatch.Restart(); } diff --git a/ComputerSystems/Commodore64/FormC64Screen.resx b/ComputerSystems/Commodore64/FormC64Screen.resx index 573a266..207e54f 100644 --- a/ComputerSystems/Commodore64/FormC64Screen.resx +++ b/ComputerSystems/Commodore64/FormC64Screen.resx @@ -1,4 +1,4 @@ - +