1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Found a way better way to update keyboard dynamically. Left old code in for people to laugh at me.

This commit is contained in:
Logan Saso 2016-02-04 23:46:49 -08:00
parent 3fdb2093e7
commit 977f88fde9
2 changed files with 31 additions and 22 deletions

View File

@ -46,6 +46,15 @@ namespace Artemis.KeyboardProviders.Corsair
/// <param name="bitmap"></param> /// <param name="bitmap"></param>
public override void DrawBitmap(Bitmap bitmap) public override void DrawBitmap(Bitmap bitmap)
{ {
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]; RectangleF[,] ledRectangles = new RectangleF[bitmap.Width, bitmap.Height];
RectangleKeyGroup[,] ledGroups = new RectangleKeyGroup[bitmap.Width, bitmap.Height]; RectangleKeyGroup[,] ledGroups = new RectangleKeyGroup[bitmap.Width, bitmap.Height];
//_keyboard.Brush = new SolidColorBrush(Color.Black); //_keyboard.Brush = new SolidColorBrush(Color.Black);
@ -65,6 +74,6 @@ namespace Artemis.KeyboardProviders.Corsair
_keyboard.DetachKeyGroup(ledGroups[x, y]); _keyboard.DetachKeyGroup(ledGroups[x, y]);
} }
} }
} */
} }
} }

View File

@ -32,7 +32,7 @@ namespace Artemis.Utilities.GameState
_listener.Prefixes.Clear(); _listener.Prefixes.Clear();
Port = Settings.General.Default.GamestatePort; Port = Settings.General.Default.GamestatePort;
_listener.Prefixes.Add($"http://127.0.0.1:{Port}/"); _listener.Prefixes.Add($"http://localhost:{Port}/");
_listener.Start(); _listener.Start();