diff options
| author | Michael <[email protected]> | 2017-07-06 18:25:19 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-07-06 18:25:19 -0400 |
| commit | ca339b2661ee565d55191d58ed40c2303f77c0b4 (patch) | |
| tree | 0554a0f3f1a4b08bf89a49001a89b37af3fa3e8d /ShiftOS.Frontend/ShiftOS.cs | |
| parent | 38774ba7930f9d6fa2111c8b71f1056125ab75b5 (diff) | |
| download | shiftos_thereturn-ca339b2661ee565d55191d58ed40c2303f77c0b4.tar.gz shiftos_thereturn-ca339b2661ee565d55191d58ed40c2303f77c0b4.tar.bz2 shiftos_thereturn-ca339b2661ee565d55191d58ed40c2303f77c0b4.zip | |
HEAVILY optimize the game
Diffstat (limited to 'ShiftOS.Frontend/ShiftOS.cs')
| -rw-r--r-- | ShiftOS.Frontend/ShiftOS.cs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ShiftOS.Frontend/ShiftOS.cs b/ShiftOS.Frontend/ShiftOS.cs index 9ad83da..1ab0ad1 100644 --- a/ShiftOS.Frontend/ShiftOS.cs +++ b/ShiftOS.Frontend/ShiftOS.cs @@ -98,6 +98,8 @@ namespace ShiftOS.Frontend } + private double timeSinceLastPurge = 0; + private Texture2D MouseTexture = null; /// <summary> @@ -214,6 +216,14 @@ namespace ShiftOS.Frontend //Cause layout update on all elements UIManager.LayoutUpdate(); + timeSinceLastPurge += gameTime.ElapsedGameTime.TotalSeconds; + + if(timeSinceLastPurge > 30) + { + GraphicsContext.StringCaches.Clear(); + timeSinceLastPurge = 0; + } + base.Update(gameTime); } @@ -252,7 +262,7 @@ namespace ShiftOS.Frontend { var gfxContext = new GraphicsContext(GraphicsDevice.GraphicsDevice, spriteBatch, 0, 0, GraphicsDevice.PreferredBackBufferWidth, GraphicsDevice.PreferredBackBufferHeight); var color = Color.White; - double fps = 1 / gameTime.ElapsedGameTime.TotalSeconds; + double fps = Math.Round(1 / gameTime.ElapsedGameTime.TotalSeconds); if (fps <= 20) color = Color.Red; gfxContext.DrawString($@"ShiftOS 1.0 Beta 4 |
