mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-12 21:38:38 +00:00
Experimental Razer support / KeyboardRectangle refactoring
This commit is contained in:
parent
380abe2e61
commit
4c1b6e9936
@ -4,12 +4,24 @@
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings"
|
||||
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.Modules.Games.Witcher3.Witcher3" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 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.Offsets"
|
||||
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"
|
||||
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||
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"
|
||||
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
@ -192,7 +204,7 @@
|
||||
<value>TypeWave</value>
|
||||
</setting>
|
||||
<setting name="LastKeyboard" serializeAs="String">
|
||||
<value>Logitech G910 Orion Spark RGB</value>
|
||||
<value>Razer BlackWidow Chroma</value>
|
||||
</setting>
|
||||
<setting name="EnablePointersUpdate" serializeAs="String">
|
||||
<value>True</value>
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
<SccProvider>
|
||||
</SccProvider>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<PublishUrl>C:\Users\spoin\Desktop\Artemis builds\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
@ -33,8 +33,8 @@
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>2</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.0</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
@ -71,6 +71,9 @@
|
||||
<PropertyGroup>
|
||||
<SignManifests>false</SignManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>logo.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<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>
|
||||
@ -80,6 +83,14 @@
|
||||
<HintPath>..\packages\Caliburn.Micro.2.0.2\lib\net45\Caliburn.Micro.Platform.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</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">
|
||||
<HintPath>..\packages\MahApps.Metro.1.1.2.0\lib\net45\MahApps.Metro.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@ -171,6 +182,8 @@
|
||||
<Compile Include="KeyboardProviders\Logitech\Utilities\LogitechGSDK.cs" />
|
||||
<Compile Include="KeyboardProviders\Logitech\Utilities\OrionUtilities.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\GamePointersCollectionModel.cs" />
|
||||
<Compile Include="Modules\Effects\AudioVisualizer\AudioVisualization.Designer.cs">
|
||||
@ -411,6 +424,7 @@
|
||||
<Content Include="LogitechLedEnginesWrapper.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Resource Include="logo.ico" />
|
||||
<Content Include="Resources\gamestateConfigFileCsGo.txt" />
|
||||
<Resource Include="Resources\Entypo-license.txt" />
|
||||
<Resource Include="Resources\WindowsIcons-license.txt" />
|
||||
|
||||
@ -5,6 +5,8 @@ namespace Artemis.KeyboardProviders
|
||||
public abstract class KeyboardProvider
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public int Height { get; set; }
|
||||
public int Width { get; set; }
|
||||
|
||||
public abstract void Enable();
|
||||
public abstract void Disable();
|
||||
|
||||
@ -9,6 +9,8 @@ namespace Artemis.KeyboardProviders.Logitech
|
||||
public Orion()
|
||||
{
|
||||
Name = "Logitech G910 Orion Spark RGB";
|
||||
Height = 6;
|
||||
Width = 21;
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Artemis.KeyboardProviders.Corsair;
|
||||
using Artemis.KeyboardProviders.Logitech;
|
||||
using Artemis.KeyboardProviders.Razer;
|
||||
|
||||
namespace Artemis.KeyboardProviders
|
||||
{
|
||||
@ -12,7 +13,8 @@ namespace Artemis.KeyboardProviders
|
||||
{
|
||||
new Orion(),
|
||||
new K70(),
|
||||
new K95()
|
||||
new K95(),
|
||||
new BlackWidow()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
33
Artemis/Artemis/KeyboardProviders/Razer/BlackWidow.cs
Normal file
33
Artemis/Artemis/KeyboardProviders/Razer/BlackWidow.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -16,9 +16,11 @@ namespace Artemis.Models
|
||||
public string Description { get; set; }
|
||||
public IntPtr BasePointer { get; set; }
|
||||
public int[] Offsets { get; set; }
|
||||
|
||||
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")}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4,7 +4,6 @@ using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Events;
|
||||
using Artemis.KeyboardProviders;
|
||||
using Artemis.Settings;
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
<?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 />
|
||||
<Settings>
|
||||
<Setting Name="Sensitivity" Type="System.Int32" Scope="User">
|
||||
|
||||
@ -17,8 +17,8 @@ namespace Artemis.Modules.Effects.AudioVisualizer
|
||||
private const int FftLength = 2048;
|
||||
private readonly SampleAggregator _sampleAggregator = new SampleAggregator(FftLength);
|
||||
private bool _generating;
|
||||
private IWaveIn _waveIn;
|
||||
private bool _previousFromBottom;
|
||||
private IWaveIn _waveIn;
|
||||
|
||||
public AudioVisualizerModel(AudioVisualizerSettings settings)
|
||||
{
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
using System.Windows.Media;
|
||||
using Artemis.Models;
|
||||
using Artemis.Settings;
|
||||
|
||||
namespace Artemis.Modules.Effects.AudioVisualizer
|
||||
{
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
|
||||
@ -43,9 +43,12 @@
|
||||
<Label FontSize="16" Content="CS:GO Directory" Style="{DynamicResource DescriptionHeaderStyle}"
|
||||
FontFamily="Segoe UI Semibold" Foreground="#535353" Width="130" HorizontalAlignment="Left" />
|
||||
<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]" />
|
||||
<Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944" HorizontalAlignment="Right" Width="25"
|
||||
Style="{DynamicResource SquareButtonStyle}" Height="25"/>
|
||||
<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]" />
|
||||
<Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944"
|
||||
HorizontalAlignment="Right" Width="25"
|
||||
Style="{DynamicResource SquareButtonStyle}" Height="25" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="2"
|
||||
@ -62,7 +65,8 @@
|
||||
<Label FontSize="16" Content="Ammo main color" Style="{DynamicResource DescriptionHeaderStyle}"
|
||||
FontFamily="Segoe UI Semibold" Foreground="#535353" Width="180" />
|
||||
<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 Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
@ -70,7 +74,8 @@
|
||||
<Label FontSize="16" Content="Ammo secondary color" Style="{DynamicResource DescriptionHeaderStyle}"
|
||||
FontFamily="Segoe UI Semibold" Foreground="#535353" Width="180" />
|
||||
<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 Grid.Row="4"
|
||||
Grid.Column="0"
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using Artemis.Models;
|
||||
using Artemis.Properties;
|
||||
using Screen = Caliburn.Micro.Screen;
|
||||
|
||||
namespace Artemis.Modules.Games.CounterStrike
|
||||
@ -59,8 +59,10 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
return;
|
||||
if (Directory.Exists(CounterStrikeSettings.GameDirectory + "/csgo/cfg"))
|
||||
{
|
||||
var cfgFile = Properties.Resources.gamestateConfigFileCsGo.Replace("{{port}}", MainModel.GameStateWebServer.Port.ToString());
|
||||
File.WriteAllText(CounterStrikeSettings.GameDirectory + "/csgo/cfg/gamestate_integration_artemis.cfg", cfgFile);
|
||||
var cfgFile = Resources.gamestateConfigFileCsGo.Replace("{{port}}",
|
||||
MainModel.GameStateWebServer.Port.ToString());
|
||||
File.WriteAllText(CounterStrikeSettings.GameDirectory + "/csgo/cfg/gamestate_integration_artemis.cfg",
|
||||
cfgFile);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -10,7 +10,6 @@ using Artemis.Settings;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.Utilities.Keyboard;
|
||||
using Artemis.Utilities.Memory;
|
||||
using MyMemory;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Modules.Games.RocketLeague
|
||||
@ -21,10 +20,10 @@ namespace Artemis.Modules.Games.RocketLeague
|
||||
|
||||
private int _boostAmount;
|
||||
private bool _boostGrowing;
|
||||
private int _previousBoost;
|
||||
|
||||
private Memory _memory;
|
||||
private GamePointersCollectionModel _pointer;
|
||||
private int _previousBoost;
|
||||
|
||||
public RocketLeagueModel(RocketLeagueSettings settings)
|
||||
{
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
<?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 />
|
||||
<Settings>
|
||||
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
<?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 />
|
||||
<Settings>
|
||||
<Setting Name="MainColor" Type="System.Windows.Media.Color" Scope="User">
|
||||
|
||||
2
Artemis/Artemis/Settings/General.Designer.cs
generated
2
Artemis/Artemis/Settings/General.Designer.cs
generated
@ -37,7 +37,7 @@ namespace Artemis.Settings {
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Logitech G910 Orion Spark RGB")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Razer BlackWidow Chroma")]
|
||||
public string LastKeyboard {
|
||||
get {
|
||||
return ((string)(this["LastKeyboard"]));
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
<Value Profile="(Default)">TypeWave</Value>
|
||||
</Setting>
|
||||
<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 Name="EnablePointersUpdate" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
<?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 />
|
||||
<Settings>
|
||||
<Setting Name="RocketLeague" Type="System.String" Scope="User">
|
||||
|
||||
@ -40,11 +40,13 @@ namespace Artemis.Utilities.Keyboard
|
||||
Rotate = false;
|
||||
LoopSpeed = 1;
|
||||
Visible = true;
|
||||
ContainedBrush = true;
|
||||
|
||||
_rotationProgress = 0;
|
||||
_blinkWorker.DoWork += BlinkWorker_DoWork;
|
||||
}
|
||||
|
||||
public bool ContainedBrush { get; set; }
|
||||
public int Scale { get; set; }
|
||||
public byte Opacity { get; set; }
|
||||
public int X { get; set; }
|
||||
@ -113,23 +115,18 @@ namespace Artemis.Utilities.Keyboard
|
||||
|
||||
public void Draw(Graphics g)
|
||||
{
|
||||
if (!Visible || Height < 1 || Width < 1 || Colors.Count < 1)
|
||||
if (!Visible || Height < 1 || Width < 1 || !Colors.Any())
|
||||
return;
|
||||
|
||||
var colorBlend = new ColorBlend {Colors = Colors.ToArray()};
|
||||
if (Opacity < 255)
|
||||
for (var i = 0; i < colorBlend.Colors.Length; i++)
|
||||
colorBlend.Colors[i] = Color.FromArgb(Opacity, colorBlend.Colors[i]);
|
||||
|
||||
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 brush = ContainedBrush
|
||||
? CreateContainedBrush()
|
||||
: CreateBrush();
|
||||
var colorBlend = CreateColorBlend();
|
||||
|
||||
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;
|
||||
if (Colors.Count > 5)
|
||||
baseBrush = new LinearGradientBrush(brushRect, Colors.First(), Colors.Skip(1).FirstOrDefault(),
|
||||
@ -147,5 +144,48 @@ namespace Artemis.Utilities.Keyboard
|
||||
if (_rotationProgress > Width)
|
||||
_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
BIN
Artemis/Artemis/logo.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 361 KiB |
@ -3,7 +3,9 @@
|
||||
<packages>
|
||||
<package id="Caliburn.Micro" 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="log4net" version="2.0.4" 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="NAudio" version="1.7.3" targetFramework="net452" />
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user