From 89dfed83afbb8272388940cd0b4b46b8b066153f Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 27 Jul 2017 12:03:55 -0400 Subject: Hacking UI is coming in. --- ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs | 10 ++-------- ShiftOS.Frontend/GraphicsSubsystem/UIManager.cs | 4 +++- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'ShiftOS.Frontend/GraphicsSubsystem') diff --git a/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs b/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs index e75b00d..d8e447c 100644 --- a/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs +++ b/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs @@ -105,22 +105,16 @@ namespace ShiftOS.Frontend.GraphicsSubsystem { x += _startx; y += _starty; - var tex2 = new Texture2D(_graphicsDevice, 1, 1, false, SurfaceFormat.Color); - byte[] colordata = new byte[] { color.B, color.G, color.R, color.A }; - tex2.SetData(colordata); int distance = (int)Vector2.Distance(new Vector2(x, y), new Vector2(x1, y1)); float rotation = getRotation(x, y, x1, y1); - _spritebatch.Draw(tex2, new Rectangle(x, y, distance, thickness), null, color, rotation, Vector2.Zero, SpriteEffects.None, 0); + _spritebatch.Draw(UIManager.SkinTextures["PureWhite"], new Rectangle(x, y, distance, thickness), null, color, rotation, Vector2.Zero, SpriteEffects.None, 0); } public void DrawRectangle(int x, int y, int width, int height, Color color) { x += _startx; y += _starty; - var tex2 = new Texture2D(_graphicsDevice, 1, 1, false, SurfaceFormat.Color); - byte[] colordata = new byte[] { 255, 255, 255, 255 }; - tex2.SetData(colordata); - _spritebatch.Draw(tex2, new Rectangle(x, y, width, height), color); + _spritebatch.Draw(UIManager.SkinTextures["PureWhite"], new Rectangle(x, y, width, height), color); } public void DrawRectangle(int x, int y, int width, int height, Texture2D tex2) diff --git a/ShiftOS.Frontend/GraphicsSubsystem/UIManager.cs b/ShiftOS.Frontend/GraphicsSubsystem/UIManager.cs index 96ef3cb..43762cf 100644 --- a/ShiftOS.Frontend/GraphicsSubsystem/UIManager.cs +++ b/ShiftOS.Frontend/GraphicsSubsystem/UIManager.cs @@ -233,7 +233,9 @@ namespace ShiftOS.Frontend.GraphicsSubsystem SkinTextures.Add(colorfield.Name, tex2); } - + var pureWhite = new Texture2D(graphics, 1, 1); + pureWhite.SetData(new byte[] { 255, 255, 255, 255 }); + SkinTextures.Add("PureWhite", pureWhite); } -- cgit v1.2.3