1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Experimental Razer support / KeyboardRectangle refactoring

This commit is contained in:
Robert Beekman 2016-01-19 16:46:11 +01:00
parent 380abe2e61
commit 4c1b6e9936
24 changed files with 223 additions and 46 deletions

View File

@ -4,12 +4,24 @@
<configSections> <configSections>
<sectionGroup name="userSettings" <sectionGroup name="userSettings"
type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="Artemis.Settings.Offsets" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> <section name="Artemis.Settings.Offsets"
<section name="Artemis.Modules.Games.Witcher3.Witcher3" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
<section name="Artemis.Modules.Effects.AudioVisualizer.AudioVisualization" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Modules.Games.CounterStrike.CounterStrike" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> <section name="Artemis.Modules.Games.Witcher3.Witcher3"
<section name="Artemis.Settings.CounterStrike" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
<section name="Artemis.Settings.VolumeDisplay" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Modules.Effects.AudioVisualizer.AudioVisualization"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Modules.Games.CounterStrike.CounterStrike"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.CounterStrike"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.VolumeDisplay"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.AudioVisualization" <section name="Artemis.Settings.AudioVisualization"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" /> allowExeDefinition="MachineToLocalUser" requirePermission="false" />
@ -192,7 +204,7 @@
<value>TypeWave</value> <value>TypeWave</value>
</setting> </setting>
<setting name="LastKeyboard" serializeAs="String"> <setting name="LastKeyboard" serializeAs="String">
<value>Logitech G910 Orion Spark RGB</value> <value>Razer BlackWidow Chroma</value>
</setting> </setting>
<setting name="EnablePointersUpdate" serializeAs="String"> <setting name="EnablePointersUpdate" serializeAs="String">
<value>True</value> <value>True</value>

View File

@ -23,7 +23,7 @@
<SccProvider> <SccProvider>
</SccProvider> </SccProvider>
<IsWebBootstrapper>false</IsWebBootstrapper> <IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl> <PublishUrl>C:\Users\spoin\Desktop\Artemis builds\</PublishUrl>
<Install>true</Install> <Install>true</Install>
<InstallFrom>Disk</InstallFrom> <InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled> <UpdateEnabled>false</UpdateEnabled>
@ -33,8 +33,8 @@
<UpdatePeriodically>false</UpdatePeriodically> <UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired> <UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions> <MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>2</ApplicationRevision> <ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> <ApplicationVersion>1.0.0.0</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted> <PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
@ -71,6 +71,9 @@
<PropertyGroup> <PropertyGroup>
<SignManifests>false</SignManifests> <SignManifests>false</SignManifests>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<ApplicationIcon>logo.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Caliburn.Micro, Version=2.0.2.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL"> <Reference Include="Caliburn.Micro, Version=2.0.2.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
<HintPath>..\packages\Caliburn.Micro.Core.2.0.2\lib\net45\Caliburn.Micro.dll</HintPath> <HintPath>..\packages\Caliburn.Micro.Core.2.0.2\lib\net45\Caliburn.Micro.dll</HintPath>
@ -80,6 +83,14 @@
<HintPath>..\packages\Caliburn.Micro.2.0.2\lib\net45\Caliburn.Micro.Platform.dll</HintPath> <HintPath>..\packages\Caliburn.Micro.2.0.2\lib\net45\Caliburn.Micro.Platform.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Corale.Colore, Version=3.0.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Colore.3.0.2\lib\net35\Corale.Colore.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="log4net, Version=1.2.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.4\lib\net45-full\log4net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MahApps.Metro, Version=1.1.2.0, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL"> <Reference Include="MahApps.Metro, Version=1.1.2.0, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.1.2.0\lib\net45\MahApps.Metro.dll</HintPath> <HintPath>..\packages\MahApps.Metro.1.1.2.0\lib\net45\MahApps.Metro.dll</HintPath>
<Private>True</Private> <Private>True</Private>
@ -171,6 +182,8 @@
<Compile Include="KeyboardProviders\Logitech\Utilities\LogitechGSDK.cs" /> <Compile Include="KeyboardProviders\Logitech\Utilities\LogitechGSDK.cs" />
<Compile Include="KeyboardProviders\Logitech\Utilities\OrionUtilities.cs" /> <Compile Include="KeyboardProviders\Logitech\Utilities\OrionUtilities.cs" />
<Compile Include="KeyboardProviders\ProviderHelper.cs" /> <Compile Include="KeyboardProviders\ProviderHelper.cs" />
<Compile Include="KeyboardProviders\Razer\BlackWidow.cs" />
<Compile Include="KeyboardProviders\Razer\Utilities\RazerUtilities.cs" />
<Compile Include="Models\EffectModel.cs" /> <Compile Include="Models\EffectModel.cs" />
<Compile Include="Models\GamePointersCollectionModel.cs" /> <Compile Include="Models\GamePointersCollectionModel.cs" />
<Compile Include="Modules\Effects\AudioVisualizer\AudioVisualization.Designer.cs"> <Compile Include="Modules\Effects\AudioVisualizer\AudioVisualization.Designer.cs">
@ -411,6 +424,7 @@
<Content Include="LogitechLedEnginesWrapper.dll"> <Content Include="LogitechLedEnginesWrapper.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Resource Include="logo.ico" />
<Content Include="Resources\gamestateConfigFileCsGo.txt" /> <Content Include="Resources\gamestateConfigFileCsGo.txt" />
<Resource Include="Resources\Entypo-license.txt" /> <Resource Include="Resources\Entypo-license.txt" />
<Resource Include="Resources\WindowsIcons-license.txt" /> <Resource Include="Resources\WindowsIcons-license.txt" />

View File

@ -5,6 +5,8 @@ namespace Artemis.KeyboardProviders
public abstract class KeyboardProvider public abstract class KeyboardProvider
{ {
public string Name { get; set; } public string Name { get; set; }
public int Height { get; set; }
public int Width { get; set; }
public abstract void Enable(); public abstract void Enable();
public abstract void Disable(); public abstract void Disable();

View File

@ -9,6 +9,8 @@ namespace Artemis.KeyboardProviders.Logitech
public Orion() public Orion()
{ {
Name = "Logitech G910 Orion Spark RGB"; Name = "Logitech G910 Orion Spark RGB";
Height = 6;
Width = 21;
} }
public override void Enable() public override void Enable()

View File

@ -1,6 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using Artemis.KeyboardProviders.Corsair; using Artemis.KeyboardProviders.Corsair;
using Artemis.KeyboardProviders.Logitech; using Artemis.KeyboardProviders.Logitech;
using Artemis.KeyboardProviders.Razer;
namespace Artemis.KeyboardProviders namespace Artemis.KeyboardProviders
{ {
@ -12,7 +13,8 @@ namespace Artemis.KeyboardProviders
{ {
new Orion(), new Orion(),
new K70(), new K70(),
new K95() new K95(),
new BlackWidow()
}; };
} }
} }

View File

@ -0,0 +1,33 @@
using System.Drawing;
using Artemis.KeyboardProviders.Razer.Utilities;
using Corale.Colore.Core;
using Corale.Colore.Razer.Keyboard;
namespace Artemis.KeyboardProviders.Razer
{
public class BlackWidow : KeyboardProvider
{
public BlackWidow()
{
Name = "Razer BlackWidow Chroma";
Height = (int) Constants.MaxRows;
Width = (int) Constants.MaxColumns;
}
public override void Enable()
{
Chroma.Instance.Initialize();
}
public override void Disable()
{
Chroma.Instance.Uninitialize();
}
public override void DrawBitmap(Bitmap bitmap)
{
var razerArray = RazerUtilities.BitmapColorArray(bitmap, Height, Width);
Chroma.Instance.Keyboard.SetGrid(razerArray);
}
}
}

View File

@ -0,0 +1,57 @@
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using Color = Corale.Colore.Core.Color;
namespace Artemis.KeyboardProviders.Razer.Utilities
{
public static class RazerUtilities
{
public static Color[][] BitmapColorArray(Bitmap b, int height, int width)
{
var res = new Color[height][];
if (b.Width > width || b.Height > height)
b = ResizeImage(b, width, height);
for (var y = 0; y < b.Height - 1; y++)
{
res[y] = new Color[width];
for (var x = 0; x < b.Width - 1; x++)
res[y][x] = b.GetPixel(x, y);
}
return res;
}
/// <summary>
/// Resize the image to the specified width and height.
/// </summary>
/// <param name="image">The image to resize.</param>
/// <param name="width">The width to resize to.</param>
/// <param name="height">The height to resize to.</param>
/// <returns>The resized image.</returns>
public static Bitmap ResizeImage(Image image, int width, int height)
{
var destRect = new Rectangle(0, 0, width, height);
var destImage = new Bitmap(width, height);
destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution);
using (var graphics = Graphics.FromImage(destImage))
{
graphics.CompositingMode = CompositingMode.SourceCopy;
graphics.CompositingQuality = CompositingQuality.HighQuality;
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.SmoothingMode = SmoothingMode.HighQuality;
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
using (var wrapMode = new ImageAttributes())
{
wrapMode.SetWrapMode(WrapMode.TileFlipXY);
graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, wrapMode);
}
}
return destImage;
}
}
}

View File

@ -16,9 +16,11 @@ namespace Artemis.Models
public string Description { get; set; } public string Description { get; set; }
public IntPtr BasePointer { get; set; } public IntPtr BasePointer { get; set; }
public int[] Offsets { get; set; } public int[] Offsets { get; set; }
public override string ToString() public override string ToString()
{ {
return Offsets.Aggregate(BasePointer.ToString("X"), (current, offset) => current + $"+{offset.ToString("X")}"); return Offsets.Aggregate(BasePointer.ToString("X"),
(current, offset) => current + $"+{offset.ToString("X")}");
} }
} }
} }

View File

@ -4,7 +4,6 @@ using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using Artemis.Events; using Artemis.Events;
using Artemis.KeyboardProviders; using Artemis.KeyboardProviders;
using Artemis.Settings; using Artemis.Settings;

View File

@ -1,5 +1,7 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Modules.Effects.AudioVisualizer" GeneratedClassName="AudioVisualization">
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
GeneratedClassNamespace="Artemis.Modules.Effects.AudioVisualizer" GeneratedClassName="AudioVisualization">
<Profiles /> <Profiles />
<Settings> <Settings>
<Setting Name="Sensitivity" Type="System.Int32" Scope="User"> <Setting Name="Sensitivity" Type="System.Int32" Scope="User">

View File

@ -17,8 +17,8 @@ namespace Artemis.Modules.Effects.AudioVisualizer
private const int FftLength = 2048; private const int FftLength = 2048;
private readonly SampleAggregator _sampleAggregator = new SampleAggregator(FftLength); private readonly SampleAggregator _sampleAggregator = new SampleAggregator(FftLength);
private bool _generating; private bool _generating;
private IWaveIn _waveIn;
private bool _previousFromBottom; private bool _previousFromBottom;
private IWaveIn _waveIn;
public AudioVisualizerModel(AudioVisualizerSettings settings) public AudioVisualizerModel(AudioVisualizerSettings settings)
{ {

View File

@ -1,6 +1,5 @@
using System.Windows.Media; using System.Windows.Media;
using Artemis.Models; using Artemis.Models;
using Artemis.Settings;
namespace Artemis.Modules.Effects.AudioVisualizer namespace Artemis.Modules.Effects.AudioVisualizer
{ {

View File

@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Linq; using System.Linq;

View File

@ -43,9 +43,12 @@
<Label FontSize="16" Content="CS:GO Directory" Style="{DynamicResource DescriptionHeaderStyle}" <Label FontSize="16" Content="CS:GO Directory" Style="{DynamicResource DescriptionHeaderStyle}"
FontFamily="Segoe UI Semibold" Foreground="#535353" Width="130" HorizontalAlignment="Left" /> FontFamily="Segoe UI Semibold" Foreground="#535353" Width="130" HorizontalAlignment="Left" />
<Grid> <Grid>
<TextBox x:Name="GameDirectory" Height="23" TextWrapping="Wrap" Margin="5,0,30,0" Text="{Binding Path=CounterStrikeSettings.GameDirectory, Mode=TwoWay}" cal:Message.Attach="[Event LostFocus] = [Action PlaceConfigFile]" /> <TextBox x:Name="GameDirectory" Height="23" TextWrapping="Wrap" Margin="5,0,30,0"
<Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944" HorizontalAlignment="Right" Width="25" Text="{Binding Path=CounterStrikeSettings.GameDirectory, Mode=TwoWay}"
Style="{DynamicResource SquareButtonStyle}" Height="25"/> cal:Message.Attach="[Event LostFocus] = [Action PlaceConfigFile]" />
<Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944"
HorizontalAlignment="Right" Width="25"
Style="{DynamicResource SquareButtonStyle}" Height="25" />
</Grid> </Grid>
</StackPanel> </StackPanel>
<StackPanel Grid.Row="2" <StackPanel Grid.Row="2"
@ -62,7 +65,8 @@
<Label FontSize="16" Content="Ammo main color" Style="{DynamicResource DescriptionHeaderStyle}" <Label FontSize="16" Content="Ammo main color" Style="{DynamicResource DescriptionHeaderStyle}"
FontFamily="Segoe UI Semibold" Foreground="#535353" Width="180" /> FontFamily="Segoe UI Semibold" Foreground="#535353" Width="180" />
<xctk:ColorPicker x:Name="MainColor" <xctk:ColorPicker x:Name="MainColor"
SelectedColor="{Binding Path=CounterStrikeSettings.AmmoMainColor, Mode=TwoWay}" Margin="5,0,0,0" /> SelectedColor="{Binding Path=CounterStrikeSettings.AmmoMainColor, Mode=TwoWay}"
Margin="5,0,0,0" />
</StackPanel> </StackPanel>
<StackPanel Grid.Row="3" <StackPanel Grid.Row="3"
Grid.Column="1" Grid.Column="1"
@ -70,7 +74,8 @@
<Label FontSize="16" Content="Ammo secondary color" Style="{DynamicResource DescriptionHeaderStyle}" <Label FontSize="16" Content="Ammo secondary color" Style="{DynamicResource DescriptionHeaderStyle}"
FontFamily="Segoe UI Semibold" Foreground="#535353" Width="180" /> FontFamily="Segoe UI Semibold" Foreground="#535353" Width="180" />
<xctk:ColorPicker x:Name="SecondaryColor" <xctk:ColorPicker x:Name="SecondaryColor"
SelectedColor="{Binding Path=CounterStrikeSettings.AmmoSecondaryColor, Mode=TwoWay}" Margin="5,0,0,0" /> SelectedColor="{Binding Path=CounterStrikeSettings.AmmoSecondaryColor, Mode=TwoWay}"
Margin="5,0,0,0" />
</StackPanel> </StackPanel>
<StackPanel Grid.Row="4" <StackPanel Grid.Row="4"
Grid.Column="0" Grid.Column="0"

View File

@ -1,7 +1,7 @@
using System; using System.IO;
using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using Artemis.Models; using Artemis.Models;
using Artemis.Properties;
using Screen = Caliburn.Micro.Screen; using Screen = Caliburn.Micro.Screen;
namespace Artemis.Modules.Games.CounterStrike namespace Artemis.Modules.Games.CounterStrike
@ -59,8 +59,10 @@ namespace Artemis.Modules.Games.CounterStrike
return; return;
if (Directory.Exists(CounterStrikeSettings.GameDirectory + "/csgo/cfg")) if (Directory.Exists(CounterStrikeSettings.GameDirectory + "/csgo/cfg"))
{ {
var cfgFile = Properties.Resources.gamestateConfigFileCsGo.Replace("{{port}}", MainModel.GameStateWebServer.Port.ToString()); var cfgFile = Resources.gamestateConfigFileCsGo.Replace("{{port}}",
File.WriteAllText(CounterStrikeSettings.GameDirectory + "/csgo/cfg/gamestate_integration_artemis.cfg", cfgFile); MainModel.GameStateWebServer.Port.ToString());
File.WriteAllText(CounterStrikeSettings.GameDirectory + "/csgo/cfg/gamestate_integration_artemis.cfg",
cfgFile);
return; return;
} }

View File

@ -10,7 +10,6 @@ using Artemis.Settings;
using Artemis.Utilities; using Artemis.Utilities;
using Artemis.Utilities.Keyboard; using Artemis.Utilities.Keyboard;
using Artemis.Utilities.Memory; using Artemis.Utilities.Memory;
using MyMemory;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace Artemis.Modules.Games.RocketLeague namespace Artemis.Modules.Games.RocketLeague
@ -21,10 +20,10 @@ namespace Artemis.Modules.Games.RocketLeague
private int _boostAmount; private int _boostAmount;
private bool _boostGrowing; private bool _boostGrowing;
private int _previousBoost;
private Memory _memory; private Memory _memory;
private GamePointersCollectionModel _pointer; private GamePointersCollectionModel _pointer;
private int _previousBoost;
public RocketLeagueModel(RocketLeagueSettings settings) public RocketLeagueModel(RocketLeagueSettings settings)
{ {

View File

@ -1,5 +1,7 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Modules.Games.Witcher3" GeneratedClassName="Witcher3">
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
GeneratedClassNamespace="Artemis.Modules.Games.Witcher3" GeneratedClassName="Witcher3">
<Profiles /> <Profiles />
<Settings> <Settings>
<Setting Name="Enabled" Type="System.Boolean" Scope="User"> <Setting Name="Enabled" Type="System.Boolean" Scope="User">

View File

@ -1,5 +1,7 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Settings" GeneratedClassName="VolumeDisplay">
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
GeneratedClassNamespace="Artemis.Settings" GeneratedClassName="VolumeDisplay">
<Profiles /> <Profiles />
<Settings> <Settings>
<Setting Name="MainColor" Type="System.Windows.Media.Color" Scope="User"> <Setting Name="MainColor" Type="System.Windows.Media.Color" Scope="User">

View File

@ -37,7 +37,7 @@ namespace Artemis.Settings {
[global::System.Configuration.UserScopedSettingAttribute()] [global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Logitech G910 Orion Spark RGB")] [global::System.Configuration.DefaultSettingValueAttribute("Razer BlackWidow Chroma")]
public string LastKeyboard { public string LastKeyboard {
get { get {
return ((string)(this["LastKeyboard"])); return ((string)(this["LastKeyboard"]));

View File

@ -6,7 +6,7 @@
<Value Profile="(Default)">TypeWave</Value> <Value Profile="(Default)">TypeWave</Value>
</Setting> </Setting>
<Setting Name="LastKeyboard" Type="System.String" Scope="User"> <Setting Name="LastKeyboard" Type="System.String" Scope="User">
<Value Profile="(Default)">Logitech G910 Orion Spark RGB</Value> <Value Profile="(Default)">Razer BlackWidow Chroma</Value>
</Setting> </Setting>
<Setting Name="EnablePointersUpdate" Type="System.Boolean" Scope="User"> <Setting Name="EnablePointersUpdate" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value> <Value Profile="(Default)">True</Value>

View File

@ -1,5 +1,7 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Settings" GeneratedClassName="Offsets">
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
GeneratedClassNamespace="Artemis.Settings" GeneratedClassName="Offsets">
<Profiles /> <Profiles />
<Settings> <Settings>
<Setting Name="RocketLeague" Type="System.String" Scope="User"> <Setting Name="RocketLeague" Type="System.String" Scope="User">

View File

@ -40,11 +40,13 @@ namespace Artemis.Utilities.Keyboard
Rotate = false; Rotate = false;
LoopSpeed = 1; LoopSpeed = 1;
Visible = true; Visible = true;
ContainedBrush = true;
_rotationProgress = 0; _rotationProgress = 0;
_blinkWorker.DoWork += BlinkWorker_DoWork; _blinkWorker.DoWork += BlinkWorker_DoWork;
} }
public bool ContainedBrush { get; set; }
public int Scale { get; set; } public int Scale { get; set; }
public byte Opacity { get; set; } public byte Opacity { get; set; }
public int X { get; set; } public int X { get; set; }
@ -113,23 +115,18 @@ namespace Artemis.Utilities.Keyboard
public void Draw(Graphics g) public void Draw(Graphics g)
{ {
if (!Visible || Height < 1 || Width < 1 || Colors.Count < 1) if (!Visible || Height < 1 || Width < 1 || !Colors.Any())
return; return;
var colorBlend = new ColorBlend {Colors = Colors.ToArray()}; var brush = ContainedBrush
if (Opacity < 255) ? CreateContainedBrush()
for (var i = 0; i < colorBlend.Colors.Length; i++) : CreateBrush();
colorBlend.Colors[i] = Color.FromArgb(Opacity, colorBlend.Colors[i]); var colorBlend = CreateColorBlend();
var devider = (float) Colors.Count - 1;
var positions = new List<float>();
for (var i = 0; i < Colors.Count; i++)
positions.Add(i/devider);
colorBlend.Positions = positions.ToArray();
var baseRect = new Rectangle(X, Y, Width, Height); var baseRect = new Rectangle(X, Y, Width, Height);
var brushRect = new Rectangle((int) _rotationProgress, Y, baseRect.Width*2, baseRect.Height*2); var brushRect = ContainedBrush
? new Rectangle((int) _rotationProgress, Y, baseRect.Width*2, baseRect.Height*2)
: new Rectangle((int) _rotationProgress, 0, 21*2, 8*2);
LinearGradientBrush baseBrush; LinearGradientBrush baseBrush;
if (Colors.Count > 5) if (Colors.Count > 5)
baseBrush = new LinearGradientBrush(brushRect, Colors.First(), Colors.Skip(1).FirstOrDefault(), baseBrush = new LinearGradientBrush(brushRect, Colors.First(), Colors.Skip(1).FirstOrDefault(),
@ -147,5 +144,48 @@ namespace Artemis.Utilities.Keyboard
if (_rotationProgress > Width) if (_rotationProgress > Width)
_rotationProgress = LoopSpeed; _rotationProgress = LoopSpeed;
} }
private LinearGradientBrush CreateContainedBrush()
{
//throw new NotImplementedException();
return null;
}
private LinearGradientBrush CreateBrush()
{
var colorBlend = CreateColorBlend();
var rect = new Rectangle(0, 0, 21, 8);
if (Colors.Count > 5)
return new LinearGradientBrush(rect, Colors[0], Colors[1], GradientMode)
{
InterpolationColors = colorBlend
};
return Colors.Count > 1
? new LinearGradientBrush(rect, Colors[0], Colors[1], GradientMode)
: new LinearGradientBrush(rect, Colors[0], Colors[0], GradientMode);
}
private ColorBlend CreateColorBlend()
{
var colorBlend = new ColorBlend {Colors = Colors.ToArray()};
// If needed, apply opacity to the colors in the blend
if (Opacity < 255)
for (var i = 0; i < colorBlend.Colors.Length; i++)
colorBlend.Colors[i] = Color.FromArgb(Opacity, colorBlend.Colors[i]);
// Devide the colors over the colorblend
var devider = (float) Colors.Count - 1;
var positions = new List<float>();
for (var i = 0; i < Colors.Count; i++)
positions.Add(i/devider);
// Apply the devided positions
colorBlend.Positions = positions.ToArray();
return colorBlend;
}
} }
} }

BIN
Artemis/Artemis/logo.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

View File

@ -3,7 +3,9 @@
<packages> <packages>
<package id="Caliburn.Micro" version="2.0.2" targetFramework="net452" /> <package id="Caliburn.Micro" version="2.0.2" targetFramework="net452" />
<package id="Caliburn.Micro.Core" version="2.0.2" targetFramework="net452" /> <package id="Caliburn.Micro.Core" version="2.0.2" targetFramework="net452" />
<package id="Colore" version="3.0.2" targetFramework="net452" />
<package id="Extended.Wpf.Toolkit" version="2.5" targetFramework="net452" /> <package id="Extended.Wpf.Toolkit" version="2.5" targetFramework="net452" />
<package id="log4net" version="2.0.4" targetFramework="net452" />
<package id="MahApps.Metro" version="1.1.2.0" targetFramework="net452" /> <package id="MahApps.Metro" version="1.1.2.0" targetFramework="net452" />
<package id="MahApps.Metro.Resources" version="0.4.0.0" targetFramework="net452" /> <package id="MahApps.Metro.Resources" version="0.4.0.0" targetFramework="net452" />
<package id="NAudio" version="1.7.3" targetFramework="net452" /> <package id="NAudio" version="1.7.3" targetFramework="net452" />