diff --git a/Source/Core/Config/ProgramConfiguration.cs b/Source/Core/Config/ProgramConfiguration.cs index 00190c33..36a36ba7 100755 --- a/Source/Core/Config/ProgramConfiguration.cs +++ b/Source/Core/Config/ProgramConfiguration.cs @@ -93,6 +93,7 @@ namespace CodeImp.DoomBuilder.Config private bool splitjoinedsectors; //mxd private bool usehighlight; //mxd private bool switchviewmodes; //mxd + private bool showfps; //mxd. Script editor settings private string scriptfontname; @@ -201,6 +202,7 @@ namespace CodeImp.DoomBuilder.Config public SplitLineBehavior SplitLineBehavior { get { return splitlinebehavior; } set { splitlinebehavior = value; } } //mxd public MergeGeometryMode MergeGeometryMode { get { return mergegeomode; } internal set { mergegeomode = value; } } //mxd public bool SplitJoinedSectors { get { return splitjoinedsectors; } internal set { splitjoinedsectors = value; } } //mxd + public bool ShowFPS { get { return showfps; } internal set { showfps = value; } } //mxd. Highlight mode public bool UseHighlight @@ -347,6 +349,7 @@ namespace CodeImp.DoomBuilder.Config splitjoinedsectors = cfg.ReadSetting("splitjoinedsectors", true); //mxd usehighlight = cfg.ReadSetting("usehighlight", true); //mxd switchviewmodes = cfg.ReadSetting("switchviewmodes", false); //mxd + showfps = cfg.ReadSetting("showfps", false); //mxd. Script editor scriptfontname = cfg.ReadSetting("scriptfontname", "Courier New"); @@ -460,6 +463,7 @@ namespace CodeImp.DoomBuilder.Config cfg.WriteSetting("splitjoinedsectors", splitjoinedsectors); //mxd cfg.WriteSetting("usehighlight", usehighlight); //mxd cfg.WriteSetting("switchviewmodes", switchviewmodes); //mxd + cfg.WriteSetting("showfps", showfps); //mxd. Script editor cfg.WriteSetting("scriptfontname", scriptfontname); diff --git a/Source/Core/Rendering/Renderer3D.cs b/Source/Core/Rendering/Renderer3D.cs index c54c28c1..fd37e49b 100755 --- a/Source/Core/Rendering/Renderer3D.cs +++ b/Source/Core/Rendering/Renderer3D.cs @@ -310,7 +310,7 @@ namespace CodeImp.DoomBuilder.Rendering // This starts rendering public bool Start() { - if (!fpsWatch.IsRunning) + if (General.Settings.ShowFPS && !fpsWatch.IsRunning) fpsWatch.Start(); // Start drawing @@ -493,14 +493,16 @@ namespace CodeImp.DoomBuilder.Rendering visualvertices = null; - // - fps++; - if (fpsWatch.ElapsedMilliseconds > 1000) - { - fpsLabel.Text = string.Format("{0} FPS", fps); - fps = 0; - fpsWatch.Restart(); - } + if (General.Settings.ShowFPS) + { + fps++; + if (fpsWatch.ElapsedMilliseconds > 1000) + { + fpsLabel.Text = string.Format("{0} FPS", fps); + fps = 0; + fpsWatch.Restart(); + } + } } // [ZZ] black renderer magic here. @@ -1866,7 +1868,8 @@ namespace CodeImp.DoomBuilder.Rendering // Draw graphics.Draw(PrimitiveType.TriangleStrip, 0, 2, crosshairverts); - General.Map.Renderer2D.RenderText(fpsLabel); + if (General.Settings.ShowFPS) + General.Map.Renderer2D.RenderText(fpsLabel); } // This switches fog on and off diff --git a/Source/Core/Windows/PreferencesForm.Designer.cs b/Source/Core/Windows/PreferencesForm.Designer.cs index 8599c4d5..c2358c49 100755 --- a/Source/Core/Windows/PreferencesForm.Designer.cs +++ b/Source/Core/Windows/PreferencesForm.Designer.cs @@ -210,6 +210,7 @@ namespace CodeImp.DoomBuilder.Windows this.tabpasting = new System.Windows.Forms.TabPage(); this.label16 = new System.Windows.Forms.Label(); this.pasteoptions = new CodeImp.DoomBuilder.Controls.PasteOptionsControl(); + this.cbShowFPS = new System.Windows.Forms.CheckBox(); groupBox1 = new System.Windows.Forms.GroupBox(); label7 = new System.Windows.Forms.Label(); label5 = new System.Windows.Forms.Label(); @@ -1436,6 +1437,7 @@ namespace CodeImp.DoomBuilder.Windows this.appearancegroup1.Controls.Add(label27); this.appearancegroup1.Controls.Add(this.labelanisotropicfiltering); this.appearancegroup1.Controls.Add(this.anisotropicfiltering); + this.appearancegroup1.Controls.Add(this.cbShowFPS); this.appearancegroup1.Controls.Add(this.cbOldHighlightMode); this.appearancegroup1.Controls.Add(this.cbStretchView); this.appearancegroup1.Controls.Add(this.doublesidedalphalabel); @@ -2363,6 +2365,16 @@ namespace CodeImp.DoomBuilder.Windows this.pasteoptions.Size = new System.Drawing.Size(666, 427); this.pasteoptions.TabIndex = 0; // + // cbShowFPS + // + this.cbShowFPS.AutoSize = true; + this.cbShowFPS.Location = new System.Drawing.Point(229, 466); + this.cbShowFPS.Name = "cbShowFPS"; + this.cbShowFPS.Size = new System.Drawing.Size(148, 17); + this.cbShowFPS.TabIndex = 15; + this.cbShowFPS.Text = "Show FPS in Visual Mode"; + this.cbShowFPS.UseVisualStyleBackColor = true; + // // PreferencesForm // this.AcceptButton = this.apply; @@ -2612,5 +2624,6 @@ namespace CodeImp.DoomBuilder.Windows private System.Windows.Forms.ComboBox textlabelfontsize; private CodeImp.DoomBuilder.Controls.ColorControl colorguidelines; private System.Windows.Forms.CheckBox texturesizesbelow; - } + private System.Windows.Forms.CheckBox cbShowFPS; + } } \ No newline at end of file diff --git a/Source/Core/Windows/PreferencesForm.cs b/Source/Core/Windows/PreferencesForm.cs index 0739416b..14667337 100755 --- a/Source/Core/Windows/PreferencesForm.cs +++ b/Source/Core/Windows/PreferencesForm.cs @@ -95,6 +95,7 @@ namespace CodeImp.DoomBuilder.Windows toolbar_testing.Checked = General.Settings.ToolbarTesting; showtexturesizes.Checked = General.Settings.ShowTextureSizes; texturesizesbelow.Checked = General.Settings.TextureSizesBelow; + cbShowFPS.Checked = General.Settings.ShowFPS; //mxd locatetexturegroup.Checked = General.Settings.LocateTextureGroup; @@ -331,6 +332,7 @@ namespace CodeImp.DoomBuilder.Windows General.Settings.LocateTextureGroup = locatetexturegroup.Checked; //mxd General.Settings.MaxRecentFiles = recentFiles.Value; //mxd General.Settings.ScreenshotsPath = screenshotsfolderpath.Text.Trim(); //mxd + General.Settings.ShowFPS = cbShowFPS.Checked; // Script settings General.Settings.ScriptFontBold = scriptfontbold.Checked;