diff --git a/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs b/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs index b92da1f29..08c899437 100644 --- a/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs +++ b/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs @@ -45,26 +45,35 @@ namespace Artemis.KeyboardProviders.Corsair /// /// public override void DrawBitmap(Bitmap bitmap) - { - RectangleF[,] ledRectangles = new RectangleF[bitmap.Width, bitmap.Height]; - RectangleKeyGroup[,] ledGroups = new RectangleKeyGroup[bitmap.Width, bitmap.Height]; - //_keyboard.Brush = new SolidColorBrush(Color.Black); - for (var x = 0 ; x < bitmap.Width; x++) - { - for (var y = 0; y < bitmap.Height; y++) - { - ledRectangles[x, y] = new RectangleF(_keyboard.KeyboardRectangle.X * (x*(_keyboard.KeyboardRectangle.Width / bitmap.Width / _keyboard.KeyboardRectangle.X)), _keyboard.KeyboardRectangle.Y*(y*(_keyboard.KeyboardRectangle.Height / bitmap.Height / _keyboard.KeyboardRectangle.Y)), _keyboard.KeyboardRectangle.Width / bitmap.Width, _keyboard.KeyboardRectangle.Height / bitmap.Height); - ledGroups[x, y] = new RectangleKeyGroup(_keyboard, ledRectangles[x, y], 0.01f) { Brush = new SolidColorBrush(bitmap.GetPixel(x, y)) }; - } - } - _keyboard.Update(); - for (var x = 0; x < bitmap.Width; x++) - { - for (var y = 0; y < bitmap.Height; y++) - { - _keyboard.DetachKeyGroup(ledGroups[x, y]); - } - } - } + { + Bitmap resize = new Bitmap(bitmap, new Size((int)_keyboard.KeyboardRectangle.Width, (int)_keyboard.KeyboardRectangle.Height)); + foreach (var item in _keyboard.Keys) + { + item.Led.Color = resize.GetPixel((int)item.KeyRectangle.X, (int)item.KeyRectangle.Y); + } + _keyboard.Update(); + } + + /* + RectangleF[,] ledRectangles = new RectangleF[bitmap.Width, bitmap.Height]; + RectangleKeyGroup[,] ledGroups = new RectangleKeyGroup[bitmap.Width, bitmap.Height]; + //_keyboard.Brush = new SolidColorBrush(Color.Black); + for (var x = 0 ; x < bitmap.Width; x++) + { + for (var y = 0; y < bitmap.Height; y++) + { + ledRectangles[x, y] = new RectangleF(_keyboard.KeyboardRectangle.X * (x*(_keyboard.KeyboardRectangle.Width / bitmap.Width / _keyboard.KeyboardRectangle.X)), _keyboard.KeyboardRectangle.Y*(y*(_keyboard.KeyboardRectangle.Height / bitmap.Height / _keyboard.KeyboardRectangle.Y)), _keyboard.KeyboardRectangle.Width / bitmap.Width, _keyboard.KeyboardRectangle.Height / bitmap.Height); + ledGroups[x, y] = new RectangleKeyGroup(_keyboard, ledRectangles[x, y], 0.01f) { Brush = new SolidColorBrush(bitmap.GetPixel(x, y)) }; + } + } + _keyboard.Update(); + for (var x = 0; x < bitmap.Width; x++) + { + for (var y = 0; y < bitmap.Height; y++) + { + _keyboard.DetachKeyGroup(ledGroups[x, y]); + } + } + */ } } \ No newline at end of file diff --git a/Artemis/Artemis/Utilities/GameState/GameStateWebServer.cs b/Artemis/Artemis/Utilities/GameState/GameStateWebServer.cs index 1021bf93d..4aeca2862 100644 --- a/Artemis/Artemis/Utilities/GameState/GameStateWebServer.cs +++ b/Artemis/Artemis/Utilities/GameState/GameStateWebServer.cs @@ -32,7 +32,7 @@ namespace Artemis.Utilities.GameState _listener.Prefixes.Clear(); Port = Settings.General.Default.GamestatePort; - _listener.Prefixes.Add($"http://127.0.0.1:{Port}/"); + _listener.Prefixes.Add($"http://localhost:{Port}/"); _listener.Start();