Added option in Preferences -> Appearance -> Rendering to toggle showing of the FPS counter in Visual Mode (disabled by default)

This commit is contained in:
biwa 2020-09-26 18:15:01 +02:00
parent 63eb538b7f
commit 8064bc63b7
4 changed files with 33 additions and 11 deletions

View file

@ -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);

View file

@ -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,7 +493,8 @@ namespace CodeImp.DoomBuilder.Rendering
visualvertices = null;
//
if (General.Settings.ShowFPS)
{
fps++;
if (fpsWatch.ElapsedMilliseconds > 1000)
{
@ -502,6 +503,7 @@ namespace CodeImp.DoomBuilder.Rendering
fpsWatch.Restart();
}
}
}
// [ZZ] black renderer magic here.
// todo maybe implement proper frustum culling eventually?
@ -1866,6 +1868,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Draw
graphics.Draw(PrimitiveType.TriangleStrip, 0, 2, crosshairverts);
if (General.Settings.ShowFPS)
General.Map.Renderer2D.RenderText(fpsLabel);
}

View file

@ -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;
}
}

View file

@ -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;