diff options
| author | Michael <[email protected]> | 2017-08-05 15:50:39 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-08-05 15:50:39 -0400 |
| commit | 2352fcc7a1af388def5d7b0c9172f805d707d2c7 (patch) | |
| tree | fb11aa6da63b99d5a2272277bf94a5c6039681bd | |
| parent | ec363f09caa99f8b0ffa9351950fed5629f396f7 (diff) | |
| download | shiftos_thereturn-2352fcc7a1af388def5d7b0c9172f805d707d2c7.tar.gz shiftos_thereturn-2352fcc7a1af388def5d7b0c9172f805d707d2c7.tar.bz2 shiftos_thereturn-2352fcc7a1af388def5d7b0c9172f805d707d2c7.zip | |
tint support in GraphicsContext.DrawLine and DrawRectangle
| -rw-r--r-- | ShiftOS.Frontend/GUI/ListView.cs | 5 | ||||
| -rw-r--r-- | ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs | 14 |
2 files changed, 16 insertions, 3 deletions
diff --git a/ShiftOS.Frontend/GUI/ListView.cs b/ShiftOS.Frontend/GUI/ListView.cs index b74203d..d4f22a7 100644 --- a/ShiftOS.Frontend/GUI/ListView.cs +++ b/ShiftOS.Frontend/GUI/ListView.cs @@ -169,7 +169,10 @@ namespace ShiftOS.Frontend.GUI if(image != null) { int imageDrawX = _itemx + ((textwidth - texwidth) / 2); - gfx.DrawRectangle(imageDrawX, _itemy, texwidth, texheight, image); + Color tint = Color.White; + if (_items.IndexOf(item) == _selected) + tint = LoadedSkin.ButtonPressedColor.ToMonoColor(); + gfx.DrawRectangle(imageDrawX, _itemy, texwidth, texheight, image, tint); } int texty = _itemy + texheight; diff --git a/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs b/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs index 76e97c0..217eb33 100644 --- a/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs +++ b/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs @@ -94,11 +94,16 @@ namespace ShiftOS.Frontend.GraphicsSubsystem public void DrawLine(int x, int y, int x1, int y1, int thickness, Texture2D tex2) { + DrawLine(x, y, x1, y1, thickness, tex2, Color.White); + } + + public void DrawLine(int x, int y, int x1, int y1, int thickness, Texture2D tex2, Color tint) + { x += _startx; y += _starty; 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.White, rotation, Vector2.Zero, SpriteEffects.None, 0); + _spritebatch.Draw(tex2, new Rectangle(x, y, distance, thickness), null, tint, rotation, Vector2.Zero, SpriteEffects.None, 0); } public void DrawLine(int x, int y, int x1, int y1, int thickness, Color color) @@ -119,9 +124,14 @@ namespace ShiftOS.Frontend.GraphicsSubsystem public void DrawRectangle(int x, int y, int width, int height, Texture2D tex2) { + DrawRectangle(x, y, width, height, tex2, Color.White); + } + + public void DrawRectangle(int x, int y, int width, int height, Texture2D tex2, Color tint) + { x += _startx; y += _starty; - _spritebatch.Draw(tex2, new Rectangle(x, y, width, height), Color.White); + _spritebatch.Draw(tex2, new Rectangle(x, y, width, height), tint); } public Vector2 MeasureString(string text, System.Drawing.Font font, int wrapWidth = int.MaxValue) |
