From 31a31bf7eba8a3e1a91c39bcb55a13e1482a7589 Mon Sep 17 00:00:00 2001 From: Wolfspirit Date: Sat, 28 Nov 2015 12:54:35 +0100 Subject: [PATCH 1/3] Add BreathingType to Keyboard Breathing Effect --- Corale.Colore/Corale.Colore.csproj | 1 + .../Razer/Keyboard/Effects/Breathing.cs | 23 +++++++- .../Razer/Keyboard/Effects/BreathingType.cs | 58 +++++++++++++++++++ 3 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 Corale.Colore/Razer/Keyboard/Effects/BreathingType.cs diff --git a/Corale.Colore/Corale.Colore.csproj b/Corale.Colore/Corale.Colore.csproj index aac6c676..e8262caf 100644 --- a/Corale.Colore/Corale.Colore.csproj +++ b/Corale.Colore/Corale.Colore.csproj @@ -126,6 +126,7 @@ + diff --git a/Corale.Colore/Razer/Keyboard/Effects/Breathing.cs b/Corale.Colore/Razer/Keyboard/Effects/Breathing.cs index 681113a7..fe1ce9c9 100644 --- a/Corale.Colore/Razer/Keyboard/Effects/Breathing.cs +++ b/Corale.Colore/Razer/Keyboard/Effects/Breathing.cs @@ -41,6 +41,12 @@ namespace Corale.Colore.Razer.Keyboard.Effects [StructLayout(LayoutKind.Sequential)] public struct Breathing { + /// + /// The type of breathing effect. + /// + [UsedImplicitly] + public readonly BreathingType Type; + /// /// First color. /// @@ -56,12 +62,25 @@ public struct Breathing /// /// Initializes a new instance of the struct. /// - /// First color. + /// The type of breathing effect. + /// Initial color. /// Second color. - public Breathing(Color first, Color second) + public Breathing(BreathingType type, Color first, Color second) { + Type = type; First = first; Second = second; } + + /// + /// Initializes a new instance of the struct with + /// two colors to breathe between. + /// + /// Initial color. + /// Second color. + public Breathing(Color first, Color second) + : this(BreathingType.Two, first, second) + { + } } } diff --git a/Corale.Colore/Razer/Keyboard/Effects/BreathingType.cs b/Corale.Colore/Razer/Keyboard/Effects/BreathingType.cs new file mode 100644 index 00000000..9688a92e --- /dev/null +++ b/Corale.Colore/Razer/Keyboard/Effects/BreathingType.cs @@ -0,0 +1,58 @@ +// --------------------------------------------------------------------------------------- +// +// Copyright © 2015 by Adam Hellberg and Brandon Scott. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Disclaimer: Corale and/or Colore is in no way affiliated with Razer and/or any +// of its employees and/or licensors. Corale, Adam Hellberg, and/or Brandon Scott +// do not take responsibility for any harm caused, direct or indirect, to any +// Razer peripherals via the use of Colore. +// +// "Razer" is a trademark of Razer USA Ltd. +// +// --------------------------------------------------------------------------------------- + +namespace Corale.Colore.Razer.Keyboard.Effects +{ + using Corale.Colore.Annotations; + + /// + /// Supported breathing effect types for mouse pads. + /// + public enum BreathingType + { + /// + /// Breathes between two specified colors. + /// + [PublicAPI] + Two = 1, + + /// + /// Breathes between two random colors. + /// + [PublicAPI] + Random, + + /// + /// Invalid type. + /// + [PublicAPI] + Invalid + } +} From f45ce933d687e26dc90523393f3cd6325c97131f Mon Sep 17 00:00:00 2001 From: Wolfspirit Date: Sat, 28 Nov 2015 13:45:09 +0100 Subject: [PATCH 2/3] Replaced UsedImplicitly with PublicAPI --- Corale.Colore/Razer/Keyboard/Effects/Breathing.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Corale.Colore/Razer/Keyboard/Effects/Breathing.cs b/Corale.Colore/Razer/Keyboard/Effects/Breathing.cs index fe1ce9c9..79a6fe98 100644 --- a/Corale.Colore/Razer/Keyboard/Effects/Breathing.cs +++ b/Corale.Colore/Razer/Keyboard/Effects/Breathing.cs @@ -44,7 +44,7 @@ public struct Breathing /// /// The type of breathing effect. /// - [UsedImplicitly] + [PublicAPI] public readonly BreathingType Type; /// From 76045c53d2d7702988b81d6f34ce1760a565f8da Mon Sep 17 00:00:00 2001 From: Wolfspirit Date: Sat, 28 Nov 2015 14:24:57 +0100 Subject: [PATCH 3/3] Added parameterless SetBreathing overload for random breathing --- Corale.Colore/Core/IKeyboard.cs | 7 +++++++ Corale.Colore/Core/Keyboard.cs | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/Corale.Colore/Core/IKeyboard.cs b/Corale.Colore/Core/IKeyboard.cs index e6104126..e74ace41 100644 --- a/Corale.Colore/Core/IKeyboard.cs +++ b/Corale.Colore/Core/IKeyboard.cs @@ -83,6 +83,13 @@ public interface IKeyboard : IDevice [PublicAPI] void SetBreathing(Color first, Color second); + /// + /// Sets an effect on the keyboard, fading between + /// between randomly chosen colors. + /// + [PublicAPI] + void SetBreathing(); + /// /// Sets a reactive effect on the keyboard with the specified /// color and duration. diff --git a/Corale.Colore/Core/Keyboard.cs b/Corale.Colore/Core/Keyboard.cs index 17d2906e..eeda1649 100644 --- a/Corale.Colore/Core/Keyboard.cs +++ b/Corale.Colore/Core/Keyboard.cs @@ -215,6 +215,15 @@ public void SetBreathing(Color first, Color second) SetBreathing(new Breathing(first, second)); } + /// + /// Sets a breathing effect on the keyboard, fading + /// between randomly chosen colors. + /// + public void SetBreathing() + { + SetBreathing(new Breathing(BreathingType.Random, Color.Black, Color.Black)); + } + /// /// Sets a reactive effect on the keyboard with the specified /// color and duration.