1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00
This commit is contained in:
Logan Saso 2016-02-23 17:45:21 -08:00
commit 06c8a70e42
7 changed files with 43 additions and 20 deletions

View File

@ -232,6 +232,7 @@
<Compile Include="Events\ChangeBitmap.cs" /> <Compile Include="Events\ChangeBitmap.cs" />
<Compile Include="KeyboardProviders\Corsair\CorsairRGB.cs" /> <Compile Include="KeyboardProviders\Corsair\CorsairRGB.cs" />
<Compile Include="KeyboardProviders\KeyboardProvider.cs" /> <Compile Include="KeyboardProviders\KeyboardProvider.cs" />
<Compile Include="KeyboardProviders\KeyboardRegion.cs" />
<Compile Include="KeyboardProviders\Logitech\Orion.cs" /> <Compile Include="KeyboardProviders\Logitech\Orion.cs" />
<Compile Include="KeyboardProviders\Logitech\Utilities\KeyboardNames.cs" /> <Compile Include="KeyboardProviders\Logitech\Utilities\KeyboardNames.cs" />
<Compile Include="KeyboardProviders\Logitech\Utilities\KeyMap.cs" /> <Compile Include="KeyboardProviders\Logitech\Utilities\KeyMap.cs" />

View File

@ -1,4 +1,5 @@
using System.Drawing; using System.Collections.Generic;
using System.Drawing;
using System.Threading; using System.Threading;
using Artemis.Utilities; using Artemis.Utilities;
using CUE.NET; using CUE.NET;
@ -18,6 +19,7 @@ namespace Artemis.KeyboardProviders.Corsair
CantEnableText = "Couldn't connect to your Corsair keyboard.\n " + CantEnableText = "Couldn't connect to your Corsair keyboard.\n " +
"Please check your cables and/or drivers (could be outdated) and that Corsair Utility Engine is running.\n\n " + "Please check your cables and/or drivers (could be outdated) and that Corsair Utility Engine is running.\n\n " +
"If needed, you can select a different keyboard in Artemis under settings."; "If needed, you can select a different keyboard in Artemis under settings.";
KeyboardRegions = new List<KeyboardRegion>();
} }
public override bool CanEnable() public override bool CanEnable()
@ -71,10 +73,12 @@ namespace Artemis.KeyboardProviders.Corsair
case "K95 RGB": case "K95 RGB":
Height = 7; Height = 7;
Width = 24; Width = 24;
KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(1, 0), new Point(1, 20)));
break; break;
case "K70 RGB": case "K70 RGB":
Height = 7; Height = 7;
Width = 21; Width = 21;
KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(1, 0), new Point(1, 16)));
break; break;
case "K65 RGB": case "K65 RGB":
Height = 7; Height = 7;
@ -82,6 +86,7 @@ namespace Artemis.KeyboardProviders.Corsair
break; break;
case "STRAFE RGB": case "STRAFE RGB":
Height = 7; Height = 7;
KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(1, 0), new Point(1, 16)));
Width = 22; Width = 22;
break; break;
} }

View File

@ -1,4 +1,5 @@
using System.Drawing; using System.Collections.Generic;
using System.Drawing;
namespace Artemis.KeyboardProviders namespace Artemis.KeyboardProviders
{ {
@ -9,6 +10,8 @@ namespace Artemis.KeyboardProviders
public int Width { get; set; } public int Width { get; set; }
public string CantEnableText { get; set; } public string CantEnableText { get; set; }
public List<KeyboardRegion> KeyboardRegions { get; set; }
public abstract bool CanEnable(); public abstract bool CanEnable();
public abstract void Enable(); public abstract void Enable();
public abstract void Disable(); public abstract void Disable();

View File

@ -0,0 +1,18 @@
using System.Drawing;
namespace Artemis.KeyboardProviders
{
public class KeyboardRegion
{
public string RegionName { get; set; }
public Point TopLeft { get; set; }
public Point BottomRight { get; set; }
public KeyboardRegion(string regionName, Point topLeft, Point bottomRight)
{
RegionName = regionName;
TopLeft = topLeft;
BottomRight = bottomRight;
}
}
}

View File

@ -1,4 +1,5 @@
using System.Drawing; using System.Collections.Generic;
using System.Drawing;
using System.Threading; using System.Threading;
using Artemis.KeyboardProviders.Logitech.Utilities; using Artemis.KeyboardProviders.Logitech.Utilities;
@ -14,6 +15,7 @@ namespace Artemis.KeyboardProviders.Logitech
"If needed, you can select a different keyboard in Artemis under settings."; "If needed, you can select a different keyboard in Artemis under settings.";
Height = 6; Height = 6;
Width = 21; Width = 21;
KeyboardRegions = new List<KeyboardRegion> {new KeyboardRegion("TopRow", new Point(0, 0), new Point(0, 16))};
} }
public override bool CanEnable() public override bool CanEnable()

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Linq; using System.Linq;
using Artemis.KeyboardProviders;
using Artemis.KeyboardProviders.Corsair; using Artemis.KeyboardProviders.Corsair;
using Artemis.KeyboardProviders.Logitech; using Artemis.KeyboardProviders.Logitech;
using Artemis.Models; using Artemis.Models;
@ -16,7 +17,7 @@ namespace Artemis.Modules.Games.CounterStrike
{ {
public class CounterStrikeModel : GameModel public class CounterStrikeModel : GameModel
{ {
private int _ammoWidth; private KeyboardRegion _topRow;
public CounterStrikeModel(MainModel mainModel, CounterStrikeSettings settings) : base(mainModel) public CounterStrikeModel(MainModel mainModel, CounterStrikeSettings settings) : base(mainModel)
{ {
@ -47,23 +48,12 @@ namespace Artemis.Modules.Games.CounterStrike
public override void Enable() public override void Enable()
{ {
// Some keyboards have a different baseline, Corsair F-keys start at row 1 // Some keyboards have a different baseline, Corsair F-keys start at row 1
int baseLine; _topRow = MainModel.ActiveKeyboard.KeyboardRegions.First(r => r.RegionName == "TopRow");
if (MainModel.ActiveKeyboard is CorsairRGB) AmmoRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, _topRow.TopLeft.X, new List<Color>(),
{
baseLine = 1;
_ammoWidth = 19;
}
else
{
baseLine = 0;
_ammoWidth = 16;
}
AmmoRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, baseLine, new List<Color>(),
LinearGradientMode.Horizontal) {Height = Scale, ContainedBrush = false}; LinearGradientMode.Horizontal) {Height = Scale, ContainedBrush = false};
TeamRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, baseLine + 1, new List<Color>(), TeamRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, _topRow.TopLeft.X + 1, new List<Color>(),
LinearGradientMode.Horizontal) {Height = MainModel.ActiveKeyboard.Height*Scale - Scale}; LinearGradientMode.Horizontal) {Height = MainModel.ActiveKeyboard.Height*Scale - Scale};
EventRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, baseLine + 1, new List<Color>(), EventRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, _topRow.TopLeft.X + 1, new List<Color>(),
LinearGradientMode.Horizontal) {Height = MainModel.ActiveKeyboard.Height*Scale - Scale}; LinearGradientMode.Horizontal) {Height = MainModel.ActiveKeyboard.Height*Scale - Scale};
MainModel.GameStateWebServer.GameDataReceived += HandleGameData; MainModel.GameStateWebServer.GameDataReceived += HandleGameData;
} }
@ -162,7 +152,7 @@ namespace Artemis.Modules.Games.CounterStrike
return; return;
var ammoPercentage = (int) Math.Ceiling(100.00/maxAmmo)*ammo; var ammoPercentage = (int) Math.Ceiling(100.00/maxAmmo)*ammo;
AmmoRect.Width = (int) Math.Floor(_ammoWidth / 100.00*ammoPercentage)*Scale; AmmoRect.Width = (int) Math.Floor(_topRow.BottomRight.Y / 100.00*ammoPercentage)*Scale;
AmmoRect.Colors = new List<Color> AmmoRect.Colors = new List<Color>
{ {
ColorHelpers.ToDrawingColor(Settings.AmmoMainColor), ColorHelpers.ToDrawingColor(Settings.AmmoMainColor),

View File

@ -3,6 +3,10 @@ Artemis adds support for several games to a range of RGB keyboards.
Besides game-support there are also a few effects for when you're not gaming. Besides game-support there are also a few effects for when you're not gaming.
**Download**: https://github.com/SpoinkyNL/Artemis/releases
**FAQ**: https://github.com/SpoinkyNL/Artemis/wiki/Frequently-Asked-Questions-(FAQ)
Some of it's basic features: Some of it's basic features:
* Support for multiple keyboards planned. * Support for multiple keyboards planned.