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/Desktop | |
| 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/Desktop')
| -rw-r--r-- | ShiftOS.Frontend/Desktop/Desktop.cs | 14 | ||||
| -rw-r--r-- | ShiftOS.Frontend/Desktop/WindowManager.cs | 31 |
2 files changed, 25 insertions, 20 deletions
diff --git a/ShiftOS.Frontend/Desktop/Desktop.cs b/ShiftOS.Frontend/Desktop/Desktop.cs index af79c9c..46baf7f 100644 --- a/ShiftOS.Frontend/Desktop/Desktop.cs +++ b/ShiftOS.Frontend/Desktop/Desktop.cs @@ -110,6 +110,8 @@ namespace ShiftOS.Frontend.Desktop { } + private string dateTimeString = ""; + protected override void OnLayout() { SendToBack(); @@ -117,7 +119,14 @@ namespace ShiftOS.Frontend.Desktop Y = 0; Width = GetSize().Width; Height = GetSize().Height; - Invalidate(); + var now = DateTime.Now.TimeOfDay; + var newDateTimeString = $"{now.Hours}:{now.Minutes}:{now.Seconds}"; + if(newDateTimeString != dateTimeString) + { + dateTimeString = newDateTimeString; + Invalidate(); + } + } private List<PanelButtonData> PanelButtons = new List<PanelButtonData>(); @@ -158,8 +167,7 @@ namespace ShiftOS.Frontend.Desktop var panelClockRight = LoadedSkin.DesktopPanelClockFromRight; var panelClockTextColor = LoadedSkin.DesktopPanelClockColor.ToMonoColor(); - var dateTimeString = DateTime.Now.TimeOfDay.ToString(); - + var measure = gfx.MeasureString(dateTimeString, LoadedSkin.DesktopPanelClockFont); int panelclockleft = Width - (int)measure.X; diff --git a/ShiftOS.Frontend/Desktop/WindowManager.cs b/ShiftOS.Frontend/Desktop/WindowManager.cs index d89cbc2..22c61bf 100644 --- a/ShiftOS.Frontend/Desktop/WindowManager.cs +++ b/ShiftOS.Frontend/Desktop/WindowManager.cs @@ -322,14 +322,13 @@ namespace ShiftOS.Frontend.Desktop //Draw close button if(Shiftorium.UpgradeInstalled("close_button")) { - var closebuttoncolor = LoadedSkin.CloseButtonColor; var closebuttonsize = LoadedSkin.CloseButtonSize; var closebuttonright = LoadedSkin.CloseButtonFromSide; if (LoadedSkin.TitleButtonPosition == 0) closebuttonright = new Point(Width - closebuttonsize.Width - closebuttonright.X, closebuttonright.Y); if (!UIManager.SkinTextures.ContainsKey("closebutton")) { - gfx.DrawRectangle(closebuttonright.X, closebuttonright.Y, closebuttonsize.Width, closebuttonsize.Height, closebuttoncolor.ToMonoColor()); + gfx.DrawRectangle(closebuttonright.X, closebuttonright.Y, closebuttonsize.Width, closebuttonsize.Height, UIManager.SkinTextures["CloseButtonColor"]); } else { @@ -339,7 +338,6 @@ namespace ShiftOS.Frontend.Desktop //Draw maximize button if (Shiftorium.UpgradeInstalled("maximize_button")) { - var closebuttoncolor = LoadedSkin.MaximizeButtonColor; var closebuttonsize = LoadedSkin.MaximizeButtonSize; var closebuttonright = LoadedSkin.MaximizeButtonFromSide; if (LoadedSkin.TitleButtonPosition == 0) @@ -347,7 +345,7 @@ namespace ShiftOS.Frontend.Desktop if (!UIManager.SkinTextures.ContainsKey("maximizebutton")) { - gfx.DrawRectangle(closebuttonright.X, closebuttonright.Y, closebuttonsize.Width, closebuttonsize.Height, closebuttoncolor.ToMonoColor()); + gfx.DrawRectangle(closebuttonright.X, closebuttonright.Y, closebuttonsize.Width, closebuttonsize.Height, UIManager.SkinTextures["MaximizeButtonColor"]); } else { @@ -357,14 +355,13 @@ namespace ShiftOS.Frontend.Desktop //Draw minimize button if (Shiftorium.UpgradeInstalled("minimize_button")) { - var closebuttoncolor = LoadedSkin.MinimizeButtonColor; var closebuttonsize = LoadedSkin.MinimizeButtonSize; var closebuttonright = LoadedSkin.MinimizeButtonFromSide; if (LoadedSkin.TitleButtonPosition == 0) closebuttonright = new Point(Width - closebuttonsize.Width - closebuttonright.X, closebuttonright.Y); if (!UIManager.SkinTextures.ContainsKey("minimizebutton")) { - gfx.DrawRectangle(closebuttonright.X, closebuttonright.Y, closebuttonsize.Width, closebuttonsize.Height, closebuttoncolor.ToMonoColor()); + gfx.DrawRectangle(closebuttonright.X, closebuttonright.Y, closebuttonsize.Width, closebuttonsize.Height, UIManager.SkinTextures["MinimizeButtonColor"]); } else { @@ -388,18 +385,18 @@ namespace ShiftOS.Frontend.Desktop int bottomwidth = Width - bottomlocx - rightborderwidth; int brightlocx = Width - rightborderwidth; - var borderleftcolor = (ContainsFocusedControl || IsFocusedControl) ? LoadedSkin.BorderLeftBackground : LoadedSkin.BorderInactiveLeftBackground; - var borderrightcolor = (ContainsFocusedControl || IsFocusedControl) ? LoadedSkin.BorderRightBackground : LoadedSkin.BorderInactiveRightBackground; - var borderbottomcolor = (ContainsFocusedControl || IsFocusedControl) ? LoadedSkin.BorderBottomBackground : LoadedSkin.BorderInactiveBottomBackground; - var borderbleftcolor = (ContainsFocusedControl || IsFocusedControl) ? LoadedSkin.BorderBottomLeftBackground : LoadedSkin.BorderInactiveBottomLeftBackground; - var borderbrightcolor = (ContainsFocusedControl || IsFocusedControl) ? LoadedSkin.BorderBottomRightBackground : LoadedSkin.BorderInactiveBottomRightBackground; + var borderleftcolor = (ContainsFocusedControl || IsFocusedControl) ? UIManager.SkinTextures["BorderLeftBackground"] : UIManager.SkinTextures["BorderInactiveLeftBackground"]; + var borderrightcolor = (ContainsFocusedControl || IsFocusedControl) ? UIManager.SkinTextures["BorderRightBackground"] : UIManager.SkinTextures["BorderInactiveRightBackground"]; + var borderbottomcolor = (ContainsFocusedControl || IsFocusedControl) ? UIManager.SkinTextures["BorderBottomBackground"] : UIManager.SkinTextures["BorderInactiveBottomBackground"]; + var borderbleftcolor = (ContainsFocusedControl || IsFocusedControl) ? UIManager.SkinTextures["BorderBottomLeftBackground"] : UIManager.SkinTextures["BorderInactiveBottomLeftBackground"]; + var borderbrightcolor = (ContainsFocusedControl || IsFocusedControl) ? UIManager.SkinTextures["BorderBottomRightBackground"] : UIManager.SkinTextures["BorderInactiveBottomRightBackground"]; //draw border corners //BOTTOM LEFT if (!UIManager.SkinTextures.ContainsKey("bottomlborder")) { - gfx.DrawRectangle(0, bottomlocy, leftborderwidth, bottomborderwidth, borderbleftcolor.ToMonoColor()); + gfx.DrawRectangle(0, bottomlocy, leftborderwidth, bottomborderwidth, borderbleftcolor); } else { @@ -409,7 +406,7 @@ namespace ShiftOS.Frontend.Desktop //BOTTOM RIGHT if (!UIManager.SkinTextures.ContainsKey("bottomrborder")) { - gfx.DrawRectangle(brightlocx, bottomlocy, rightborderwidth, bottomborderwidth, borderbrightcolor.ToMonoColor()); + gfx.DrawRectangle(brightlocx, bottomlocy, rightborderwidth, bottomborderwidth, borderbrightcolor); } else { @@ -419,7 +416,7 @@ namespace ShiftOS.Frontend.Desktop //BOTTOM if (!UIManager.SkinTextures.ContainsKey("bottomborder")) { - gfx.DrawRectangle(leftborderwidth, bottomlocy, bottomwidth, bottomborderwidth, borderbottomcolor.ToMonoColor()); + gfx.DrawRectangle(leftborderwidth, bottomlocy, bottomwidth, bottomborderwidth, borderbottomcolor); } else { @@ -429,7 +426,7 @@ namespace ShiftOS.Frontend.Desktop //LEFT if (!UIManager.SkinTextures.ContainsKey("leftborder")) { - gfx.DrawRectangle(0, titleheight, leftborderwidth, Height - titleheight - bottomborderwidth, borderleftcolor.ToMonoColor()); + gfx.DrawRectangle(0, titleheight, leftborderwidth, Height - titleheight - bottomborderwidth, borderleftcolor); } else { @@ -439,7 +436,7 @@ namespace ShiftOS.Frontend.Desktop //RIGHT if (!UIManager.SkinTextures.ContainsKey("rightborder")) { - gfx.DrawRectangle(brightlocx, titleheight, rightborderwidth, Height - titleheight - bottomborderwidth, borderrightcolor.ToMonoColor()); + gfx.DrawRectangle(brightlocx, titleheight, rightborderwidth, Height - titleheight - bottomborderwidth, borderrightcolor); } else { @@ -448,7 +445,7 @@ namespace ShiftOS.Frontend.Desktop } - gfx.DrawRectangle(leftborderwidth, titleheight, Width - leftborderwidth - rightborderwidth, Height - titleheight - bottomborderwidth, LoadedSkin.ControlColor.ToMonoColor()); + gfx.DrawRectangle(leftborderwidth, titleheight, Width - leftborderwidth - rightborderwidth, Height - titleheight - bottomborderwidth, UIManager.SkinTextures["ControlColor"]); //So here's what we're gonna do now. //Now that we have a titlebar and window borders... //We're going to composite the hosted window |
