From b8da7357b00c9fb11c48ed697972f284d182feae Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 31 Jul 2017 22:48:17 -0400 Subject: adjust textcache purge --- ShiftOS.Frontend/ShiftOS.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ShiftOS.Frontend/ShiftOS.cs') diff --git a/ShiftOS.Frontend/ShiftOS.cs b/ShiftOS.Frontend/ShiftOS.cs index 866f7f5..faebd50 100644 --- a/ShiftOS.Frontend/ShiftOS.cs +++ b/ShiftOS.Frontend/ShiftOS.cs @@ -235,7 +235,7 @@ namespace ShiftOS.Frontend timeSinceLastPurge += gameTime.ElapsedGameTime.TotalSeconds; - if(timeSinceLastPurge > 30) + if(timeSinceLastPurge > 5) { GraphicsContext.StringCaches.Clear(); timeSinceLastPurge = 0; -- cgit v1.2.3 From afa0c9fdaa292d3b6b50d7703615eafb1c5a6a53 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 31 Jul 2017 22:59:02 -0400 Subject: holy shit the game runs at higher than 2fps in debug --- ShiftOS.Frontend/ShiftOS.cs | 49 +++++++++++++++------------------------------ 1 file changed, 16 insertions(+), 33 deletions(-) (limited to 'ShiftOS.Frontend/ShiftOS.cs') diff --git a/ShiftOS.Frontend/ShiftOS.cs b/ShiftOS.Frontend/ShiftOS.cs index faebd50..f431906 100644 --- a/ShiftOS.Frontend/ShiftOS.cs +++ b/ShiftOS.Frontend/ShiftOS.cs @@ -235,7 +235,7 @@ namespace ShiftOS.Frontend timeSinceLastPurge += gameTime.ElapsedGameTime.TotalSeconds; - if(timeSinceLastPurge > 5) + if(timeSinceLastPurge > 2) { GraphicsContext.StringCaches.Clear(); timeSinceLastPurge = 0; @@ -309,38 +309,21 @@ namespace ShiftOS.Frontend double fps = Math.Round(1 / gameTime.ElapsedGameTime.TotalSeconds); if (fps <= 20) color = Color.Red; - gfxContext.DrawString($@"ShiftOS 1.0 Beta 4 -Copyright (c) 2017 Michael VanOverbeek, Rylan Arbour, RogueAI, william341 -This is an unstable build. -FPS: {(fps)} -An FPS below 20 can cause glitches in keyboard and mouse handling. It is advised that if you are getting these -framerates, press CTRL+E to disable fancy effects, close any apps you are not using, and try running in windowed mode -or in a lower resolution. - -If all else fails, you can set a breakpoint somewhere in the ShiftOS.Update() or ShiftOS.Draw() methods in the game's source -code and use Visual Studio's debugger to step through the code to find bottlenecks. - -If a method takes more than 30 milliseconds to complete, that is a sign that it is bottlenecking the game and may need to be -optimized. - -Try using the SkinTextures cache when rendering skin elements, and try using the GraphicsContext.DrawString() method when drawing -text. In this build, we are aware that this method causes bottlenecking, we are working on a caching system for fonts so we do not need to -use the System.Drawing.Graphics class to draw text. - -UI render target count: {UIManager.TextureCaches.Count} -Skin texture caches: {UIManager.SkinTextures.Count} -Open windows (excluding dialog boxes): {AppearanceManager.OpenForms.Count} - -Experimental effects enabled: {UIManager.ExperimentalEffects} -Fullscreen: {UIManager.Fullscreen} -Game resolution: {graphicsDevice.PreferredBackBufferWidth}x{graphicsDevice.PreferredBackBufferHeight} - -Mouse state: -X: {LastMouseState.X} -Y: {LastMouseState.Y} -Last left click MS: {mouseMS} - -", 0, 0, color, new System.Drawing.Font("Lucida Console", 9F, System.Drawing.FontStyle.Bold)); + gfxContext.DrawString($@"ShiftOS +======================= + +Copyright (c) 2017 ShiftOS Developers + +Debug information - {fps} FPS + +CTRL+D: toggle debug menu +CTRL+E: toggle experimental effects (experimental effects enabled: {UIManager.ExperimentalEffects}) +Use the ""debug"" Terminal Command for engine debug commands. + +Red text means low framerate, a low framerate could be a sign of CPU hogging code or a memory leak. + + +Text cache: {GraphicsContext.StringCaches.Count}", 0, 0, color, new System.Drawing.Font("Lucida Console", 9F, System.Drawing.FontStyle.Bold)); } spriteBatch.End(); -- cgit v1.2.3 From 6fd95f912823efc2901e7735df63e1aefa2ebb73 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 31 Jul 2017 23:04:23 -0400 Subject: perform gc when ourging caches --- ShiftOS.Frontend/ShiftOS.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'ShiftOS.Frontend/ShiftOS.cs') diff --git a/ShiftOS.Frontend/ShiftOS.cs b/ShiftOS.Frontend/ShiftOS.cs index f431906..61a20fb 100644 --- a/ShiftOS.Frontend/ShiftOS.cs +++ b/ShiftOS.Frontend/ShiftOS.cs @@ -239,6 +239,7 @@ namespace ShiftOS.Frontend { GraphicsContext.StringCaches.Clear(); timeSinceLastPurge = 0; + GC.Collect(); } -- cgit v1.2.3