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:
parent
3fdb2093e7
commit
977f88fde9
@ -45,26 +45,35 @@ namespace Artemis.KeyboardProviders.Corsair
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bitmap"></param>
|
/// <param name="bitmap"></param>
|
||||||
public override void DrawBitmap(Bitmap bitmap)
|
public override void DrawBitmap(Bitmap bitmap)
|
||||||
{
|
{
|
||||||
RectangleF[,] ledRectangles = new RectangleF[bitmap.Width, bitmap.Height];
|
Bitmap resize = new Bitmap(bitmap, new Size((int)_keyboard.KeyboardRectangle.Width, (int)_keyboard.KeyboardRectangle.Height));
|
||||||
RectangleKeyGroup[,] ledGroups = new RectangleKeyGroup[bitmap.Width, bitmap.Height];
|
foreach (var item in _keyboard.Keys)
|
||||||
//_keyboard.Brush = new SolidColorBrush(Color.Black);
|
{
|
||||||
for (var x = 0 ; x < bitmap.Width; x++)
|
item.Led.Color = resize.GetPixel((int)item.KeyRectangle.X, (int)item.KeyRectangle.Y);
|
||||||
{
|
}
|
||||||
for (var y = 0; y < bitmap.Height; y++)
|
_keyboard.Update();
|
||||||
{
|
}
|
||||||
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)) };
|
/*
|
||||||
}
|
RectangleF[,] ledRectangles = new RectangleF[bitmap.Width, bitmap.Height];
|
||||||
}
|
RectangleKeyGroup[,] ledGroups = new RectangleKeyGroup[bitmap.Width, bitmap.Height];
|
||||||
_keyboard.Update();
|
//_keyboard.Brush = new SolidColorBrush(Color.Black);
|
||||||
for (var x = 0; x < bitmap.Width; x++)
|
for (var x = 0 ; x < bitmap.Width; x++)
|
||||||
{
|
{
|
||||||
for (var y = 0; y < bitmap.Height; y++)
|
for (var y = 0; y < bitmap.Height; y++)
|
||||||
{
|
{
|
||||||
_keyboard.DetachKeyGroup(ledGroups[x, 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]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user