mirror of
https://github.com/DarthAffe/CUE.NET.git
synced 2026-11-11 13:06:24 +00:00
Refactored the positionen to be stored in the LED
This commit is contained in:
1 parent
4b5263221a
commit
bfe51add66
8 files changed
+56
-45
No files matched your search
@@ -104,16 +104,21 @@ namespace CUE.NET.Devices.Generic
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Gets the LED-Object with the specified id.
|
||||
/// Initializes the LED-Object with the specified id.
|
||||
/// </summary>
|
||||
/// <param name="ledId">The LED-Id to look for.</param>
|
||||
/// <param name="ledId">The LED-Id to initialize.</param>
|
||||
/// <param name="ledRectangle">The rectangle representing the position of the LED to initialize.</param>
|
||||
/// <returns></returns>
|
||||
protected CorsairLed GetLed(int ledId)
|
||||
protected CorsairLed InitializeLed(int ledId, RectangleF ledRectangle)
|
||||
{
|
||||
if (!Leds.ContainsKey(ledId))
|
||||
Leds.Add(ledId, new CorsairLed());
|
||||
{
|
||||
CorsairLed led = new CorsairLed(ledRectangle);
|
||||
Leds.Add(ledId, led);
|
||||
return led;
|
||||
}
|
||||
|
||||
return Leds[ledId];
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -169,7 +174,7 @@ namespace CUE.NET.Devices.Generic
|
||||
public void Update(bool flushLeds = false)
|
||||
{
|
||||
OnUpdating();
|
||||
|
||||
|
||||
DeviceUpdate();
|
||||
|
||||
ICollection<LedUpateRequest> ledsToUpdate = (flushLeds ? Leds : Leds.Where(x => x.Value.IsDirty)).Select(x => new LedUpateRequest(x.Key, x.Value.RequestedColor)).ToList();
|
||||
@@ -186,7 +191,7 @@ namespace CUE.NET.Devices.Generic
|
||||
/// Performs device specific updates.
|
||||
/// </summary>
|
||||
protected abstract void DeviceUpdate();
|
||||
|
||||
|
||||
private void UpdateLeds(ICollection<LedUpateRequest> updateRequests)
|
||||
{
|
||||
updateRequests = updateRequests.Where(x => x.Color != Color.Transparent).ToList();
|
||||
|
||||
@@ -13,6 +13,11 @@ namespace CUE.NET.Devices.Generic
|
||||
public class CorsairLed
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <summary>
|
||||
/// Gets a rectangle representing the physical location of the led.
|
||||
/// </summary>
|
||||
public RectangleF LedRectangle { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the LED has changed an internal state.
|
||||
@@ -55,7 +60,14 @@ namespace CUE.NET.Devices.Generic
|
||||
|
||||
#region Constructors
|
||||
|
||||
internal CorsairLed() { }
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CorsairLed"/> class.
|
||||
/// </summary>
|
||||
/// <param name="ledRectangle">The rectangle representing the physical location of the led.</param>
|
||||
internal CorsairLed(RectangleF ledRectangle)
|
||||
{
|
||||
this.LedRectangle = ledRectangle;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in new issue
Block a user