mirror of
https://github.com/DarthAffe/CUE.NET.git
synced 2025-12-13 09:08:34 +00:00
Added missing comments
This commit is contained in:
parent
8d32c73b6d
commit
0fc32243c8
@ -74,6 +74,7 @@ namespace CUE.NET.Brushes
|
|||||||
foreach (BrushRenderTarget point in renderTargets)
|
foreach (BrushRenderTarget point in renderTargets)
|
||||||
RenderedTargets[point] = GetColorAtPoint(rectangle, point);
|
RenderedTargets[point] = GetColorAtPoint(rectangle, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs the finalize pass of the brush and calculates the final colors for all previously calculated points.
|
/// Performs the finalize pass of the brush and calculates the final colors for all previously calculated points.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -6,18 +6,32 @@ using CUE.NET.Devices.Keyboard.Enums;
|
|||||||
|
|
||||||
namespace CUE.NET.Brushes
|
namespace CUE.NET.Brushes
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a single target of a brush render.
|
||||||
|
/// </summary>
|
||||||
public class BrushRenderTarget
|
public class BrushRenderTarget
|
||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the id of the target-key.
|
||||||
|
/// </summary>
|
||||||
public CorsairKeyboardKeyId Key { get; }
|
public CorsairKeyboardKeyId Key { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the point representing the position to render the target-key.
|
||||||
|
/// </summary>
|
||||||
public PointF Point { get; }
|
public PointF Point { get; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="BrushRenderTarget"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">The id of the target-key.</param>
|
||||||
|
/// <param name="point">The point representing the position to render the target-key.</param>
|
||||||
public BrushRenderTarget(CorsairKeyboardKeyId key, PointF point)
|
public BrushRenderTarget(CorsairKeyboardKeyId key, PointF point)
|
||||||
{
|
{
|
||||||
this.Point = point;
|
this.Point = point;
|
||||||
|
|||||||
@ -39,6 +39,9 @@ namespace CUE.NET.Brushes
|
|||||||
|
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the strongly-typed target used for the effect.
|
||||||
|
/// </summary>
|
||||||
protected override IBrush EffectTarget => this;
|
protected override IBrush EffectTarget => this;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -18,6 +18,9 @@ namespace CUE.NET.Brushes
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the strongly-typed target used for the effect.
|
||||||
|
/// </summary>
|
||||||
protected override IBrush EffectTarget => this;
|
protected override IBrush EffectTarget => this;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -12,6 +12,9 @@ namespace CUE.NET.Brushes
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the strongly-typed target used for the effect.
|
||||||
|
/// </summary>
|
||||||
protected override IBrush EffectTarget => this;
|
protected override IBrush EffectTarget => this;
|
||||||
|
|
||||||
private Dictionary<CorsairKeyboardKeyId, Color> _keyLights;
|
private Dictionary<CorsairKeyboardKeyId, Color> _keyLights;
|
||||||
|
|||||||
@ -16,6 +16,9 @@ namespace CUE.NET.Brushes
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the strongly-typed target used for the effect.
|
||||||
|
/// </summary>
|
||||||
protected override IBrush EffectTarget => this;
|
protected override IBrush EffectTarget => this;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -15,6 +15,9 @@ namespace CUE.NET.Brushes
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the strongly-typed target used for the effect.
|
||||||
|
/// </summary>
|
||||||
protected override IBrush EffectTarget => this;
|
protected override IBrush EffectTarget => this;
|
||||||
|
|
||||||
private Random _random = new Random();
|
private Random _random = new Random();
|
||||||
|
|||||||
@ -12,6 +12,9 @@ namespace CUE.NET.Brushes
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the strongly-typed target used for the effect.
|
||||||
|
/// </summary>
|
||||||
protected override IBrush EffectTarget => this;
|
protected override IBrush EffectTarget => this;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -5,18 +5,32 @@ using System.Drawing;
|
|||||||
|
|
||||||
namespace CUE.NET.Devices.Generic
|
namespace CUE.NET.Devices.Generic
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a request to update a led.
|
||||||
|
/// </summary>
|
||||||
public class LedUpateRequest
|
public class LedUpateRequest
|
||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the id of the led to update.
|
||||||
|
/// </summary>
|
||||||
public int LedId { get; }
|
public int LedId { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the requested color of the led.
|
||||||
|
/// </summary>
|
||||||
public Color Color { get; set; }
|
public Color Color { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="LedUpateRequest"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ledId">The id of the led to update.</param>
|
||||||
|
/// <param name="color">The requested color of the led.</param>
|
||||||
public LedUpateRequest(int ledId, Color color)
|
public LedUpateRequest(int ledId, Color color)
|
||||||
{
|
{
|
||||||
this.LedId = ledId;
|
this.LedId = ledId;
|
||||||
|
|||||||
@ -181,7 +181,11 @@ namespace CUE.NET.Devices.Keyboard
|
|||||||
// ReSharper disable once CatchAllClause
|
// ReSharper disable once CatchAllClause
|
||||||
catch (Exception ex) { OnException(ex); }
|
catch (Exception ex) { OnException(ex); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a list containing all LEDs of this group.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The list containing all LEDs of this group.</returns>
|
||||||
public IEnumerable<CorsairLed> GetLeds()
|
public IEnumerable<CorsairLed> GetLeds()
|
||||||
{
|
{
|
||||||
return this.Select(x => x.Led);
|
return this.Select(x => x.Led);
|
||||||
@ -242,16 +246,27 @@ namespace CUE.NET.Devices.Keyboard
|
|||||||
|
|
||||||
#region Effects
|
#region Effects
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// NOT IMPLEMENTED: Effects can't be applied directly to the keyboard. Add it to the Brush or create a keygroup instead.
|
||||||
|
/// </summary>
|
||||||
public void UpdateEffects()
|
public void UpdateEffects()
|
||||||
{
|
{
|
||||||
throw new NotSupportedException("Effects can't be applied directly to the keyboard. Add it to the Brush or create a keygroup instead.");
|
throw new NotSupportedException("Effects can't be applied directly to the keyboard. Add it to the Brush or create a keygroup instead.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// NOT IMPLEMENTED: Effects can't be applied directly to the keyboard. Add it to the Brush or create a keygroup instead.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="effect">The effect to add.</param>
|
||||||
public void AddEffect(IEffect<IKeyGroup> effect)
|
public void AddEffect(IEffect<IKeyGroup> effect)
|
||||||
{
|
{
|
||||||
throw new NotSupportedException("Effects can't be applied directly to the keyboard. Add it to the Brush or create a keygroup instead.");
|
throw new NotSupportedException("Effects can't be applied directly to the keyboard. Add it to the Brush or create a keygroup instead.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// NOT IMPLEMENTED: Effects can't be applied directly to the keyboard. Add it to the Brush or create a keygroup instead.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="effect">The effect to remove.</param>
|
||||||
public void RemoveEffect(IEffect<IKeyGroup> effect)
|
public void RemoveEffect(IEffect<IKeyGroup> effect)
|
||||||
{
|
{
|
||||||
throw new NotSupportedException("Effects can't be applied directly to the keyboard. Add it to the Brush or create a keygroup instead.");
|
throw new NotSupportedException("Effects can't be applied directly to the keyboard. Add it to the Brush or create a keygroup instead.");
|
||||||
@ -270,6 +285,10 @@ namespace CUE.NET.Devices.Keyboard
|
|||||||
return _keys.Values.GetEnumerator();
|
return _keys.Values.GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns an enumerator that iterates over all keys of the keyboard.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>An enumerator for all keys of the keyboard.</returns>
|
||||||
IEnumerator IEnumerable.GetEnumerator()
|
IEnumerator IEnumerable.GetEnumerator()
|
||||||
{
|
{
|
||||||
return GetEnumerator();
|
return GetEnumerator();
|
||||||
|
|||||||
@ -6,19 +6,34 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace CUE.NET.Effects
|
namespace CUE.NET.Effects
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents an generic effect-target.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
public abstract class AbstractEffectTarget<T> : IEffectTarget<T>
|
public abstract class AbstractEffectTarget<T> : IEffectTarget<T>
|
||||||
where T : IEffectTarget<T>
|
where T : IEffectTarget<T>
|
||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
private IList<EffectTimeContainer> _effectTimes = new List<EffectTimeContainer>();
|
private IList<EffectTimeContainer> _effectTimes = new List<EffectTimeContainer>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all <see cref="IEffect{T}" /> attached to this target.
|
||||||
|
/// </summary>
|
||||||
protected IList<IEffect<T>> Effects => _effectTimes.Select(x => x.Effect).Cast<IEffect<T>>().ToList();
|
protected IList<IEffect<T>> Effects => _effectTimes.Select(x => x.Effect).Cast<IEffect<T>>().ToList();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the strongly-typed target used for the effect.
|
||||||
|
/// </summary>
|
||||||
protected abstract T EffectTarget { get; }
|
protected abstract T EffectTarget { get; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates all effects added to this target.
|
||||||
|
/// </summary>
|
||||||
public void UpdateEffects()
|
public void UpdateEffects()
|
||||||
{
|
{
|
||||||
lock (Effects)
|
lock (Effects)
|
||||||
@ -47,6 +62,10 @@ namespace CUE.NET.Effects
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds an affect.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="effect">The effect to add.</param>
|
||||||
public void AddEffect(IEffect<T> effect)
|
public void AddEffect(IEffect<T> effect)
|
||||||
{
|
{
|
||||||
if (_effectTimes.All(x => x.Effect != effect))
|
if (_effectTimes.All(x => x.Effect != effect))
|
||||||
@ -56,6 +75,10 @@ namespace CUE.NET.Effects
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes an effect
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="effect">The effect to remove.</param>
|
||||||
public void RemoveEffect(IEffect<T> effect)
|
public void RemoveEffect(IEffect<T> effect)
|
||||||
{
|
{
|
||||||
EffectTimeContainer effectTimeToRemove = _effectTimes.FirstOrDefault(x => x.Effect == effect);
|
EffectTimeContainer effectTimeToRemove = _effectTimes.FirstOrDefault(x => x.Effect == effect);
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
// ReSharper disable MemberCanBePrivate.Global
|
// ReSharper disable MemberCanBePrivate.Global
|
||||||
|
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||||
|
|
||||||
using CUE.NET.Devices.Keyboard.Keys;
|
using CUE.NET.Devices.Keyboard.Keys;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user