1
0
mirror of https://github.com/DarthAffe/CUE.NET.git synced 2025-12-12 16:58:29 +00:00

Fixed wrong device-rectangle initialize

This commit is contained in:
Darth Affe 2016-09-11 19:39:15 +02:00
parent 69a9a122d0
commit c611675355
5 changed files with 13 additions and 4 deletions

View File

@ -37,7 +37,7 @@ namespace CUE.NET.Devices.Generic
/// <summary>
/// Gets the rectangle containing all LEDs of the device.
/// </summary>
public RectangleF DeviceRectangle { get; }
public RectangleF DeviceRectangle { get; protected set; }
/// <summary>
/// Gets a dictionary containing all LEDs of the device.
@ -139,8 +139,6 @@ namespace CUE.NET.Devices.Generic
protected AbstractCueDevice(IDeviceInfo info)
{
this.DeviceInfo = info;
DeviceRectangle = RectangleHelper.CreateRectangleFromRectangles((this).Select(x => x.LedRectangle));
}
#endregion
@ -152,7 +150,10 @@ namespace CUE.NET.Devices.Generic
/// <summary>
/// Initializes the device.
/// </summary>
public abstract void Initialize();
public virtual void Initialize()
{
DeviceRectangle = RectangleHelper.CreateRectangleFromRectangles((this).Select(x => x.LedRectangle));
}
/// <summary>
/// Initializes the LED-Object with the specified id.

View File

@ -45,6 +45,8 @@ namespace CUE.NET.Devices.Headset
{
InitializeLed(CorsairHeadsetLedId.LeftLogo, new RectangleF(0, 0, 1, 1));
InitializeLed(CorsairHeadsetLedId.RightLogo, new RectangleF(1, 0, 1, 1));
base.Initialize();
}
#endregion

View File

@ -77,6 +77,8 @@ namespace CUE.NET.Devices.Keyboard
ptr = new IntPtr(ptr.ToInt64() + structSize);
}
base.Initialize();
}
#endregion

View File

@ -67,6 +67,8 @@ namespace CUE.NET.Devices.Mouse
default:
throw new WrapperException($"Can't initial mouse with layout '{MouseDeviceInfo.PhysicalLayout}'");
}
base.Initialize();
}
#endregion

View File

@ -82,6 +82,8 @@ namespace CUE.NET.Devices.Mousemat
// Sort for easy iteration by clients
foreach (_CorsairLedPosition ledPosition in positions.OrderBy(p => p.ledId))
InitializeLed(ledPosition.ledId, new RectangleF((float)ledPosition.left, (float)ledPosition.top, (float)ledPosition.width, (float)ledPosition.height));
base.Initialize();
}
#endregion