Skip to content

Commit

Permalink
Merge pull request #130 from CoraleStudios/develop
Browse files Browse the repository at this point in the history
[HOTFIX] Missing BreathingType for Keyboard breathing effect
  • Loading branch information
brandonscott committed Nov 28, 2015
2 parents eb309eb + 401603f commit 71c6a4b
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 2 deletions.
1 change: 1 addition & 0 deletions Corale.Colore/Corale.Colore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
<Compile Include="Razer\Keyboard\Constants.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Razer\Keyboard\Effects\Breathing.cs" />
<Compile Include="Razer\Keyboard\Effects\BreathingType.cs" />
<Compile Include="Razer\Keyboard\Effects\Custom.cs" />
<Compile Include="Razer\Keyboard\Effects\Direction.cs" />
<Compile Include="Razer\Keyboard\Effects\Duration.cs" />
Expand Down
7 changes: 7 additions & 0 deletions Corale.Colore/Core/IKeyboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ public interface IKeyboard : IDevice
[PublicAPI]
void SetBreathing(Color first, Color second);

/// <summary>
/// Sets an effect on the keyboard, fading between
/// between randomly chosen colors.
/// </summary>
[PublicAPI]
void SetBreathing();

/// <summary>
/// Sets a reactive effect on the keyboard with the specified
/// color and duration.
Expand Down
9 changes: 9 additions & 0 deletions Corale.Colore/Core/Keyboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,15 @@ public void SetBreathing(Color first, Color second)
SetBreathing(new Breathing(first, second));
}

/// <summary>
/// Sets a breathing effect on the keyboard, fading
/// between randomly chosen colors.
/// </summary>
public void SetBreathing()
{
SetBreathing(new Breathing(BreathingType.Random, Color.Black, Color.Black));
}

/// <summary>
/// Sets a reactive effect on the keyboard with the specified
/// color and duration.
Expand Down
23 changes: 21 additions & 2 deletions Corale.Colore/Razer/Keyboard/Effects/Breathing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ namespace Corale.Colore.Razer.Keyboard.Effects
[StructLayout(LayoutKind.Sequential)]
public struct Breathing
{
/// <summary>
/// The type of breathing effect.
/// </summary>
[PublicAPI]
public readonly BreathingType Type;

/// <summary>
/// First color.
/// </summary>
Expand All @@ -56,12 +62,25 @@ public struct Breathing
/// <summary>
/// Initializes a new instance of the <see cref="Breathing" /> struct.
/// </summary>
/// <param name="first">First color.</param>
/// <param name="type">The type of breathing effect.</param>
/// <param name="first">Initial color.</param>
/// <param name="second">Second color.</param>
public Breathing(Color first, Color second)
public Breathing(BreathingType type, Color first, Color second)
{
Type = type;
First = first;
Second = second;
}

/// <summary>
/// Initializes a new instance of the <see cref="Breathing" /> struct with
/// two colors to breathe between.
/// </summary>
/// <param name="first">Initial color.</param>
/// <param name="second">Second color.</param>
public Breathing(Color first, Color second)
: this(BreathingType.Two, first, second)
{
}
}
}
58 changes: 58 additions & 0 deletions Corale.Colore/Razer/Keyboard/Effects/BreathingType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// ---------------------------------------------------------------------------------------
// <copyright file="BreathingType.cs" company="Corale">
// 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.
// </copyright>
// ---------------------------------------------------------------------------------------

namespace Corale.Colore.Razer.Keyboard.Effects
{
using Corale.Colore.Annotations;

/// <summary>
/// Supported breathing effect types for mouse pads.
/// </summary>
public enum BreathingType
{
/// <summary>
/// Breathes between two specified colors.
/// </summary>
[PublicAPI]
Two = 1,

/// <summary>
/// Breathes between two random colors.
/// </summary>
[PublicAPI]
Random,

/// <summary>
/// Invalid type.
/// </summary>
[PublicAPI]
Invalid
}
}

0 comments on commit 71c6a4b

Please sign in to comment.