diff --git a/Artemis/Artemis/Artemis.csproj b/Artemis/Artemis/Artemis.csproj
index 7e8f704db..212859766 100644
--- a/Artemis/Artemis/Artemis.csproj
+++ b/Artemis/Artemis/Artemis.csproj
@@ -272,6 +272,8 @@
+
+
@@ -279,7 +281,6 @@
-
EffectsView.xaml
@@ -296,6 +297,9 @@
TypeWaveView.xaml
+
+ FlyoutSettingsView.xaml
+
GamesView.xaml
@@ -317,9 +321,6 @@
VolumeDisplayView.xaml
-
- SettingsView.xaml
-
ShellView.xaml
@@ -402,6 +403,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -430,10 +435,6 @@
Designer
MSBuild:Compile
-
- Designer
- MSBuild:Compile
-
Designer
MSBuild:Compile
diff --git a/Artemis/Artemis/KeyboardProviders/KeyboardProvider.cs b/Artemis/Artemis/KeyboardProviders/KeyboardProvider.cs
index d86958c33..b5b88c39b 100644
--- a/Artemis/Artemis/KeyboardProviders/KeyboardProvider.cs
+++ b/Artemis/Artemis/KeyboardProviders/KeyboardProvider.cs
@@ -11,5 +11,17 @@ namespace Artemis.KeyboardProviders
public abstract void Enable();
public abstract void Disable();
public abstract void DrawBitmap(Bitmap bitmap);
+
+ ///
+ /// Returns a bitmap matching the keyboard's dimensions
+ ///
+ ///
+ public Bitmap KeyboardBitmap() => new Bitmap(Height, Width);
+
+ ///
+ /// Returns a bitmap matching the keyboard's dimensions using the provided scale
+ ///
+ ///
+ public Bitmap KeyboardBitmap(int scale) => new Bitmap(Height*scale, Width*scale);
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Models/EffectModel.cs b/Artemis/Artemis/Models/EffectModel.cs
index b62edb108..27a1fac9b 100644
--- a/Artemis/Artemis/Models/EffectModel.cs
+++ b/Artemis/Artemis/Models/EffectModel.cs
@@ -5,7 +5,14 @@ namespace Artemis.Models
{
public abstract class EffectModel : IDisposable
{
+ public MainModel MainModel;
public string Name;
+
+ protected EffectModel(MainModel mainModel)
+ {
+ MainModel = mainModel;
+ }
+
public abstract void Dispose();
// Called on creation
diff --git a/Artemis/Artemis/Models/GameModel.cs b/Artemis/Artemis/Models/GameModel.cs
index 6eba9c062..b1addf204 100644
--- a/Artemis/Artemis/Models/GameModel.cs
+++ b/Artemis/Artemis/Models/GameModel.cs
@@ -4,5 +4,9 @@
{
public bool Enabled;
public string ProcessName;
+
+ protected GameModel(MainModel mainModel) : base(mainModel)
+ {
+ }
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Models/OverlayModel.cs b/Artemis/Artemis/Models/OverlayModel.cs
index aa1b3479c..bd0646fa4 100644
--- a/Artemis/Artemis/Models/OverlayModel.cs
+++ b/Artemis/Artemis/Models/OverlayModel.cs
@@ -7,6 +7,10 @@ namespace Artemis.Models
private bool _enabled;
public string ProcessName;
+ protected OverlayModel(MainModel mainModel) : base(mainModel)
+ {
+ }
+
public bool Enabled
{
get { return _enabled; }
diff --git a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerModel.cs b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerModel.cs
index 800f7d0e6..f13e3e262 100644
--- a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerModel.cs
+++ b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerModel.cs
@@ -20,7 +20,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
private bool _previousFromBottom;
private IWaveIn _waveIn;
- public AudioVisualizerModel(AudioVisualizerSettings settings)
+ public AudioVisualizerModel(MainModel mainModel, AudioVisualizerSettings settings) : base(mainModel)
{
Settings = settings;
Name = "Audiovisualizer";
@@ -28,8 +28,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
SpectrumData = new List();
SoundRectangles = new List();
Scale = 4;
- Lines = 21*Scale;
-
+
// Fill list with device IDs
// Would rather just store a MMDevice object, but seems NAudio won't let me.
var deviceEnum = new MMDeviceEnumerator();
@@ -65,6 +64,8 @@ namespace Artemis.Modules.Effects.AudioVisualizer
public override void Enable()
{
+ Lines = MainModel.ActiveKeyboard.Width * Scale;
+
_sampleAggregator.FftCalculated += FftCalculated;
_sampleAggregator.PerformFFT = true;
@@ -111,8 +112,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
height = (int) (Math.Round(SpectrumData[i]/2.55));
if (SoundRectangles.Count <= i)
- SoundRectangles.Add(new KeyboardRectangle(Scale, 0, 0, 21, 6,
- new List
+ SoundRectangles.Add(new KeyboardRectangle(MainModel.ActiveKeyboard, Scale, 0, 0, new List
{
ColorHelpers.MediaColorToDrawingColor(Settings.MainColor),
ColorHelpers.MediaColorToDrawingColor(Settings.SecondaryColor)
@@ -129,7 +129,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
SoundRectangles[i].Width = (int) Math.Ceiling((double) Lines/Settings.Bars);
if (Settings.FromBottom)
- SoundRectangles[i].Y = (Scale*8) - SoundRectangles[i].Height;
+ SoundRectangles[i].Y = (Scale*MainModel.ActiveKeyboard.Height) - SoundRectangles[i].Height;
}
_generating = false;
}
@@ -145,7 +145,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
return null;
}
- var bitmap = new Bitmap(21*Scale, 6*Scale);
+ var bitmap = MainModel.ActiveKeyboard.KeyboardBitmap(Scale);
using (var g = Graphics.FromImage(bitmap))
{
foreach (var soundRectangle in SoundRectangles)
diff --git a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerViewModel.cs b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerViewModel.cs
index a8f54040f..3c4cce45c 100644
--- a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerViewModel.cs
+++ b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerViewModel.cs
@@ -18,7 +18,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
AudioVisualizerSettings = new AudioVisualizerSettings();
// Create effect model and add it to MainModel
- AudioVisualizerModel = new AudioVisualizerModel(AudioVisualizerSettings);
+ AudioVisualizerModel = new AudioVisualizerModel(mainModel, AudioVisualizerSettings);
MainModel.EffectModels.Add(AudioVisualizerModel);
}
diff --git a/Artemis/Artemis/Modules/Effects/Debug/DebugEffectModel.cs b/Artemis/Artemis/Modules/Effects/Debug/DebugEffectModel.cs
index 002707de5..15b9ca956 100644
--- a/Artemis/Artemis/Modules/Effects/Debug/DebugEffectModel.cs
+++ b/Artemis/Artemis/Modules/Effects/Debug/DebugEffectModel.cs
@@ -8,23 +8,11 @@ namespace Artemis.Modules.Effects.Debug
{
internal class DebugEffectModel : EffectModel
{
- public DebugEffectModel(DebugEffectSettings settings)
+ public DebugEffectModel(MainModel mainModel, DebugEffectSettings settings) : base(mainModel)
{
Name = "Debug Effect";
Settings = settings;
Scale = 4;
-
- KeyboardRectangle = new KeyboardRectangle(Scale, 0, 0, 21, 6,
- new List
- {
- Color.Red,
- Color.OrangeRed,
- Color.Yellow,
- Color.Green,
- Color.Blue,
- Color.Purple,
- Color.DeepPink
- }, LinearGradientMode.Horizontal);
}
public int Scale { get; set; }
@@ -39,6 +27,16 @@ namespace Artemis.Modules.Effects.Debug
public override void Enable()
{
+ KeyboardRectangle = new KeyboardRectangle(MainModel.ActiveKeyboard, Scale, 0, 0, new List
+ {
+ Color.Red,
+ Color.OrangeRed,
+ Color.Yellow,
+ Color.Green,
+ Color.Blue,
+ Color.Purple,
+ Color.DeepPink
+ }, LinearGradientMode.Horizontal);
}
public override void Update()
diff --git a/Artemis/Artemis/Modules/Effects/Debug/DebugEffectViewModel.cs b/Artemis/Artemis/Modules/Effects/Debug/DebugEffectViewModel.cs
index cdcfdbfcd..0ad0a710f 100644
--- a/Artemis/Artemis/Modules/Effects/Debug/DebugEffectViewModel.cs
+++ b/Artemis/Artemis/Modules/Effects/Debug/DebugEffectViewModel.cs
@@ -26,7 +26,7 @@ namespace Artemis.Modules.Effects.Debug
DebugEffectSettings = new DebugEffectSettings();
// Create effect model and add it to MainModel
- DebugEffectModel = new DebugEffectModel(DebugEffectSettings);
+ DebugEffectModel = new DebugEffectModel(mainModel, DebugEffectSettings);
MainModel.EffectModels.Add(DebugEffectModel);
}
diff --git a/Artemis/Artemis/Modules/Effects/TypeHole/TypeHoleModel.cs b/Artemis/Artemis/Modules/Effects/TypeHole/TypeHoleModel.cs
index 69d1075f5..10f55584b 100644
--- a/Artemis/Artemis/Modules/Effects/TypeHole/TypeHoleModel.cs
+++ b/Artemis/Artemis/Modules/Effects/TypeHole/TypeHoleModel.cs
@@ -5,7 +5,7 @@ namespace Artemis.Modules.Effects.TypeHole
{
public class TypeHoleModel : EffectModel
{
- public TypeHoleModel()
+ public TypeHoleModel(MainModel mainModel) : base(mainModel)
{
Name = "TypeHole";
}
diff --git a/Artemis/Artemis/Modules/Effects/TypeHole/TypeHoleViewModel.cs b/Artemis/Artemis/Modules/Effects/TypeHole/TypeHoleViewModel.cs
index 5ffbe12ac..ba2769e43 100644
--- a/Artemis/Artemis/Modules/Effects/TypeHole/TypeHoleViewModel.cs
+++ b/Artemis/Artemis/Modules/Effects/TypeHole/TypeHoleViewModel.cs
@@ -13,7 +13,7 @@ namespace Artemis.Modules.Effects.TypeHole
MainModel.Events.Subscribe(this);
// Create effect model and add it to MainModel
- TypeHoleModel = new TypeHoleModel();
+ TypeHoleModel = new TypeHoleModel(mainModel);
MainModel.EffectModels.Add(TypeHoleModel);
}
diff --git a/Artemis/Artemis/Modules/Effects/TypeWave/TypeWaveModel.cs b/Artemis/Artemis/Modules/Effects/TypeWave/TypeWaveModel.cs
index 6c5f5940f..0442af258 100644
--- a/Artemis/Artemis/Modules/Effects/TypeWave/TypeWaveModel.cs
+++ b/Artemis/Artemis/Modules/Effects/TypeWave/TypeWaveModel.cs
@@ -13,7 +13,7 @@ namespace Artemis.Modules.Effects.TypeWave
{
public class TypeWaveModel : EffectModel
{
- public TypeWaveModel(TypeWaveSettings settings)
+ public TypeWaveModel(MainModel mainModel, TypeWaveSettings settings) : base(mainModel)
{
Name = "TypeWave";
Waves = new List();
diff --git a/Artemis/Artemis/Modules/Effects/TypeWave/TypeWaveViewModel.cs b/Artemis/Artemis/Modules/Effects/TypeWave/TypeWaveViewModel.cs
index d5b8e4fee..f56dd7a86 100644
--- a/Artemis/Artemis/Modules/Effects/TypeWave/TypeWaveViewModel.cs
+++ b/Artemis/Artemis/Modules/Effects/TypeWave/TypeWaveViewModel.cs
@@ -18,7 +18,7 @@ namespace Artemis.Modules.Effects.TypeWave
TypeWaveSettings = new TypeWaveSettings();
// Create effect model and add it to MainModel
- TypeWaveModel = new TypeWaveModel(TypeWaveSettings);
+ TypeWaveModel = new TypeWaveModel(mainModel, TypeWaveSettings);
MainModel.EffectModels.Add(TypeWaveModel);
}
diff --git a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeModel.cs b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeModel.cs
index c7a5c8f51..f1071ba20 100644
--- a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeModel.cs
+++ b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeModel.cs
@@ -15,25 +15,13 @@ namespace Artemis.Modules.Games.CounterStrike
public class CounterStrikeModel : GameModel
{
private readonly CounterStrikeSettings _counterStrikeSettings;
- private readonly MainModel _mainModel;
- public CounterStrikeModel(CounterStrikeSettings counterStrikeSettings, MainModel mainModel)
+ public CounterStrikeModel(MainModel mainModel, CounterStrikeSettings counterStrikeSettings) : base(mainModel)
{
_counterStrikeSettings = counterStrikeSettings;
- _mainModel = mainModel;
Name = "CounterStrike";
ProcessName = "csgo";
Scale = 4;
-
- AmmoRect = new KeyboardRectangle(Scale, 0, 0, 16*Scale, 1*Scale,
- new List(),
- LinearGradientMode.Horizontal);
- TeamRect = new KeyboardRectangle(Scale, 0, 1*Scale, 21*Scale, 8*Scale,
- new List(),
- LinearGradientMode.Horizontal);
- EventRect = new KeyboardRectangle(Scale, 0, 1*Scale, 21*Scale, 8*Scale,
- new List(),
- LinearGradientMode.Horizontal);
}
public KeyboardRectangle EventRect { get; set; }
@@ -48,12 +36,16 @@ namespace Artemis.Modules.Games.CounterStrike
public override void Dispose()
{
- _mainModel.GameStateWebServer.GameDataReceived -= HandleGameData;
+ MainModel.GameStateWebServer.GameDataReceived -= HandleGameData;
}
public override void Enable()
{
- _mainModel.GameStateWebServer.GameDataReceived += HandleGameData;
+ // TODO: Size stuff
+ AmmoRect = new KeyboardRectangle(MainModel.ActiveKeyboard, Scale, 0, 0, new List(), LinearGradientMode.Horizontal);
+ TeamRect = new KeyboardRectangle(MainModel.ActiveKeyboard, Scale, 0, 1 * Scale, new List(), LinearGradientMode.Horizontal);
+ EventRect = new KeyboardRectangle(MainModel.ActiveKeyboard, Scale, 0, 1 * Scale, new List(), LinearGradientMode.Horizontal);
+ MainModel.GameStateWebServer.GameDataReceived += HandleGameData;
}
public override void Update()
diff --git a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeViewModel.cs b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeViewModel.cs
index 15750f78d..6f5bcd90b 100644
--- a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeViewModel.cs
+++ b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeViewModel.cs
@@ -18,7 +18,7 @@ namespace Artemis.Modules.Games.CounterStrike
CounterStrikeSettings = new CounterStrikeSettings();
// Create effect model and add it to MainModel
- CounterStrikeModel = new CounterStrikeModel(CounterStrikeSettings, MainModel);
+ CounterStrikeModel = new CounterStrikeModel(mainModel, CounterStrikeSettings);
MainModel.EffectModels.Add(CounterStrikeModel);
PlaceConfigFile();
}
diff --git a/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueModel.cs b/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueModel.cs
index ea92b4bc9..c7700c79a 100644
--- a/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueModel.cs
+++ b/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueModel.cs
@@ -16,29 +16,22 @@ namespace Artemis.Modules.Games.RocketLeague
{
public class RocketLeagueModel : GameModel
{
- private readonly KeyboardRectangle _boostRect;
-
+ private readonly RocketLeagueSettings _settings;
+ private KeyboardRectangle _boostRect;
private int _boostAmount;
private bool _boostGrowing;
-
private Memory _memory;
private GamePointersCollectionModel _pointer;
private int _previousBoost;
- public RocketLeagueModel(RocketLeagueSettings settings)
+ public RocketLeagueModel(MainModel mainModel, RocketLeagueSettings settings) : base(mainModel)
{
Name = "RocketLeague";
ProcessName = "RocketLeague";
Scale = 4;
-
- _boostRect = new KeyboardRectangle(Scale, 0, 0, Scale*21, Scale*8,
- new List
- {
- ColorHelpers.MediaColorToDrawingColor(settings.MainColor),
- ColorHelpers.MediaColorToDrawingColor(settings.SecondaryColor)
- }, LinearGradientMode.Horizontal);
-
Enabled = settings.Enabled;
+
+ _settings = settings;
}
public int Scale { get; set; }
@@ -50,6 +43,12 @@ namespace Artemis.Modules.Games.RocketLeague
public override void Enable()
{
+ _boostRect = new KeyboardRectangle(MainModel.ActiveKeyboard, Scale, 0, 0, new List
+ {
+ ColorHelpers.MediaColorToDrawingColor(_settings.MainColor),
+ ColorHelpers.MediaColorToDrawingColor(_settings.SecondaryColor)
+ }, LinearGradientMode.Horizontal);
+
MemoryHelpers.GetPointers();
_pointer = JsonConvert
.DeserializeObject(Offsets.Default.RocketLeague);
diff --git a/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueViewModel.cs b/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueViewModel.cs
index 067e68ad1..99035e2f5 100644
--- a/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueViewModel.cs
+++ b/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueViewModel.cs
@@ -15,7 +15,7 @@ namespace Artemis.Modules.Games.RocketLeague
RocketLeagueSettings = new RocketLeagueSettings();
// Create effect model and add it to MainModel
- RocketLeagueModel = new RocketLeagueModel(RocketLeagueSettings);
+ RocketLeagueModel = new RocketLeagueModel(mainModel, RocketLeagueSettings);
MainModel.EffectModels.Add(RocketLeagueModel);
}
diff --git a/Artemis/Artemis/Modules/Games/Witcher3/Witcher3Model.cs b/Artemis/Artemis/Modules/Games/Witcher3/Witcher3Model.cs
index b826735b5..d6d6dbb5e 100644
--- a/Artemis/Artemis/Modules/Games/Witcher3/Witcher3Model.cs
+++ b/Artemis/Artemis/Modules/Games/Witcher3/Witcher3Model.cs
@@ -15,24 +15,17 @@ namespace Artemis.Modules.Games.Witcher3
{
public class Witcher3Model : GameModel
{
- private readonly KeyboardRectangle _signRect;
-
+ private KeyboardRectangle _signRect;
private IntPtr _baseAddress;
private GamePointersCollectionModel _pointer;
private RemoteProcess _process;
- public Witcher3Model(RocketLeagueSettings settings)
+ public Witcher3Model(MainModel mainModel, RocketLeagueSettings settings) : base(mainModel)
{
Name = "Witcher3";
ProcessName = "witcher3";
Scale = 4;
- _signRect = new KeyboardRectangle(Scale, 0, 0, 84, 24, new List(), LinearGradientMode.Horizontal)
- {
- Rotate = true,
- LoopSpeed = 0.5
- };
-
Enabled = settings.Enabled;
}
@@ -45,6 +38,11 @@ namespace Artemis.Modules.Games.Witcher3
public override void Enable()
{
+ _signRect = new KeyboardRectangle(MainModel.ActiveKeyboard, Scale, 0, 0, new List(), LinearGradientMode.Horizontal)
+ {
+ Rotate = true,
+ LoopSpeed = 0.5
+ };
MemoryHelpers.GetPointers();
_pointer = JsonConvert
.DeserializeObject(Offsets.Default.Witcher3);
@@ -123,7 +121,7 @@ namespace Artemis.Modules.Games.Witcher3
public override Bitmap GenerateBitmap()
{
- var bitmap = new Bitmap(21, 6);
+ var bitmap = MainModel.ActiveKeyboard.KeyboardBitmap();
using (var g = Graphics.FromImage(bitmap))
{
g.Clear(Color.Transparent);
diff --git a/Artemis/Artemis/Modules/Games/Witcher3/Witcher3ViewModel.cs b/Artemis/Artemis/Modules/Games/Witcher3/Witcher3ViewModel.cs
index 08e7e773d..3c5cf7ddc 100644
--- a/Artemis/Artemis/Modules/Games/Witcher3/Witcher3ViewModel.cs
+++ b/Artemis/Artemis/Modules/Games/Witcher3/Witcher3ViewModel.cs
@@ -16,7 +16,7 @@ namespace Artemis.Modules.Games.Witcher3
RocketLeagueSettings = new RocketLeagueSettings();
// Create effect model and add it to MainModel
- Witcher3Model = new Witcher3Model(RocketLeagueSettings);
+ Witcher3Model = new Witcher3Model(mainModel, RocketLeagueSettings);
MainModel.EffectModels.Add(Witcher3Model);
}
diff --git a/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplay.cs b/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplay.cs
index f97a72a9d..91a897118 100644
--- a/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplay.cs
+++ b/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplay.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
+using Artemis.Models;
using Artemis.Utilities;
using Artemis.Utilities.Keyboard;
@@ -9,13 +10,16 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
{
public class VolumeDisplay
{
- public VolumeDisplay(VolumeDisplaySettings settings)
+ public VolumeDisplay(MainModel mainModel, VolumeDisplaySettings settings)
{
+ MainModel = mainModel;
Settings = settings;
Transparancy = 255;
Scale = 4;
}
+ public MainModel MainModel { get; set; }
+
public VolumeDisplaySettings Settings { get; set; }
public int Scale { get; set; }
@@ -27,7 +31,7 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
public void Draw(Graphics g)
{
- var volumeRect = new KeyboardRectangle(Scale, 0, 0, (int) Math.Ceiling(((Scale*21)/100.00)*Volume), 8*Scale,
+ var volumeRect = new KeyboardRectangle(MainModel.ActiveKeyboard, Scale, 0, 0,
new List
{
ColorHelpers.MediaColorToDrawingColor(Settings.MainColor),
diff --git a/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplayModel.cs b/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplayModel.cs
index eb2e8ecfe..042d1d8be 100644
--- a/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplayModel.cs
+++ b/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplayModel.cs
@@ -12,7 +12,7 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
{
private bool _enabled;
- public VolumeDisplayModel(VolumeDisplaySettings settings)
+ public VolumeDisplayModel(MainModel mainModel, VolumeDisplaySettings settings) : base(mainModel)
{
Settings = settings;
Name = "VolumeDisplay";
@@ -22,7 +22,7 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
Enabled = Settings.Enabled;
- VolumeDisplay = new VolumeDisplay(settings);
+ VolumeDisplay = new VolumeDisplay(mainModel, settings);
}
public VolumeDisplay VolumeDisplay { get; set; }
diff --git a/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplayViewModel.cs b/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplayViewModel.cs
index 1103c9db8..a1f0da0d3 100644
--- a/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplayViewModel.cs
+++ b/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplayViewModel.cs
@@ -15,7 +15,7 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
VolumeDisplaySettings = new VolumeDisplaySettings();
// Create effect model and add it to MainModel
- VolumeDisplayModel = new VolumeDisplayModel(VolumeDisplaySettings);
+ VolumeDisplayModel = new VolumeDisplayModel(mainModel, VolumeDisplaySettings);
MainModel.EffectModels.Add(VolumeDisplayModel);
}
diff --git a/Artemis/Artemis/Utilities/Keyboard/KeyboardRectangle.cs b/Artemis/Artemis/Utilities/Keyboard/KeyboardRectangle.cs
index 2381e874b..6f5ecb18f 100644
--- a/Artemis/Artemis/Utilities/Keyboard/KeyboardRectangle.cs
+++ b/Artemis/Artemis/Utilities/Keyboard/KeyboardRectangle.cs
@@ -5,34 +5,37 @@ using System.Drawing.Drawing2D;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using Artemis.KeyboardProviders;
namespace Artemis.Utilities.Keyboard
{
public class KeyboardRectangle
{
private readonly BackgroundWorker _blinkWorker = new BackgroundWorker {WorkerSupportsCancellation = true};
+ private readonly KeyboardProvider _keyboard;
private int _blinkDelay;
private List _colors;
private double _rotationProgress;
///
- /// Represents a Rectangle on the keyboard which can be drawn to a Bitmap
+ /// Represents a Rectangle on the keyboard which can be drawn to a Bitmap.
+ /// By default, a rectangle is the entire keyboard's size.
///
+ /// The keyboard this rectangle will be used for
/// The scale on which the rect should be rendered (Higher means smoother rotation)
///
///
- ///
- ///
/// An array of colors the ColorBlend will use
///
- public KeyboardRectangle(int scale, int x, int y, int width, int height, List colors,
+ public KeyboardRectangle(KeyboardProvider keyboard, int scale, int x, int y, List colors,
LinearGradientMode gradientMode)
{
+ _keyboard = keyboard;
Scale = scale;
X = x;
Y = y;
- Width = width;
- Height = height;
+ Width = keyboard.Width*Scale;
+ Height = keyboard.Height*Scale;
Colors = colors;
GradientMode = gradientMode;
@@ -40,7 +43,7 @@ namespace Artemis.Utilities.Keyboard
Rotate = false;
LoopSpeed = 1;
Visible = true;
- ContainedBrush = true;
+ ContainedBrush = false;
_rotationProgress = 0;
_blinkWorker.DoWork += BlinkWorker_DoWork;
@@ -53,6 +56,10 @@ namespace Artemis.Utilities.Keyboard
public int Y { get; set; }
public int Width { get; set; }
public int Height { get; set; }
+ public LinearGradientMode GradientMode { get; set; }
+ public bool Rotate { get; set; }
+ public double LoopSpeed { get; set; }
+ public bool Visible { get; set; }
public List Colors
{
@@ -67,18 +74,6 @@ namespace Artemis.Utilities.Keyboard
}
}
- public LinearGradientMode GradientMode { get; set; }
-
- public bool Rotate { get; set; }
- public double LoopSpeed { get; set; }
-
- public bool Visible { get; set; }
-
- public KeyboardRectangle Clone()
- {
- return (KeyboardRectangle) MemberwiseClone();
- }
-
public void StartBlink(int delay)
{
_blinkDelay = delay;
@@ -118,43 +113,26 @@ namespace Artemis.Utilities.Keyboard
if (!Visible || Height < 1 || Width < 1 || !Colors.Any())
return;
- var brush = ContainedBrush
- ? CreateContainedBrush()
- : CreateBrush();
- var colorBlend = CreateColorBlend();
-
+ var brush = CreateBrush();
var baseRect = new Rectangle(X, Y, Width, Height);
- 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(),
- GradientMode) {InterpolationColors = colorBlend};
- else if (Colors.Count > 1)
- baseBrush = new LinearGradientBrush(baseRect, Colors[0], Colors[1], GradientMode);
- else
- baseBrush = new LinearGradientBrush(baseRect, Colors[0], Colors[0], GradientMode);
- g.FillRectangle(baseBrush, baseRect);
+ g.FillRectangle(brush, baseRect);
if (!Rotate)
return;
_rotationProgress = _rotationProgress + LoopSpeed;
- if (_rotationProgress > Width)
+ if (ContainedBrush && _rotationProgress > Width)
+ _rotationProgress = LoopSpeed;
+ else if (!ContainedBrush && _rotationProgress > _keyboard.Width*Scale)
_rotationProgress = LoopSpeed;
- }
-
- private LinearGradientBrush CreateContainedBrush()
- {
- //throw new NotImplementedException();
- return null;
}
private LinearGradientBrush CreateBrush()
{
var colorBlend = CreateColorBlend();
- var rect = new Rectangle(0, 0, 21, 8);
+ var rect = ContainedBrush
+ ? new Rectangle((int) _rotationProgress, Y, Width, Height)
+ : new Rectangle((int) _rotationProgress, 0, _keyboard.Width*Scale, _keyboard.Height*Scale);
if (Colors.Count > 5)
return new LinearGradientBrush(rect, Colors[0], Colors[1], GradientMode)
diff --git a/Artemis/Artemis/ViewModels/FlyoutBaseViewModel.cs b/Artemis/Artemis/ViewModels/FlyoutBaseViewModel.cs
new file mode 100644
index 000000000..bbe2d6f62
--- /dev/null
+++ b/Artemis/Artemis/ViewModels/FlyoutBaseViewModel.cs
@@ -0,0 +1,56 @@
+using Caliburn.Micro;
+using MahApps.Metro.Controls;
+
+namespace Artemis.ViewModels
+{
+ public abstract class FlyoutBaseViewModel : PropertyChangedBase
+ {
+ private string header;
+
+ private bool isOpen;
+
+ private Position position;
+
+ public string Header
+ {
+ get { return header; }
+
+ set
+ {
+ if (value == header)
+ return;
+
+ header = value;
+ NotifyOfPropertyChange(() => Header);
+ }
+ }
+
+ public bool IsOpen
+ {
+ get { return isOpen; }
+
+ set
+ {
+ if (value.Equals(isOpen))
+ return;
+
+ isOpen = value;
+ NotifyOfPropertyChange(() => IsOpen);
+ }
+ }
+
+ public Position Position
+ {
+ get { return position; }
+
+ set
+ {
+ if (value == position)
+ return;
+
+ position = value;
+ NotifyOfPropertyChange(() => Position);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Artemis/Artemis/ViewModels/Flyouts/FlyoutSettingsViewModel.cs b/Artemis/Artemis/ViewModels/Flyouts/FlyoutSettingsViewModel.cs
new file mode 100644
index 000000000..52a063159
--- /dev/null
+++ b/Artemis/Artemis/ViewModels/Flyouts/FlyoutSettingsViewModel.cs
@@ -0,0 +1,13 @@
+using MahApps.Metro.Controls;
+
+namespace Artemis.ViewModels.Flyouts
+{
+ public class FlyoutSettingsViewModel : FlyoutBaseViewModel
+ {
+ public FlyoutSettingsViewModel()
+ {
+ Header = "settings";
+ Position = Position.Right;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Artemis/Artemis/ViewModels/SettingsViewModel.cs b/Artemis/Artemis/ViewModels/SettingsViewModel.cs
deleted file mode 100644
index f9f5078f3..000000000
--- a/Artemis/Artemis/ViewModels/SettingsViewModel.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using System;
-using System.Windows;
-using Artemis.Models;
-using Caliburn.Micro;
-
-namespace Artemis.ViewModels
-{
- internal sealed class ShellViewModel : Conductor.Collection.OneActive
- {
- public ShellViewModel()
- {
- IEventAggregator events = new EventAggregator();
- MainModel = new MainModel(events);
-
- DisplayName = "Artemis";
-
- ActivateItem(new EffectsViewModel(MainModel) {DisplayName = "Effects"});
- ActivateItem(new GamesViewModel(MainModel) {DisplayName = "Games"});
- ActivateItem(new OverlaysViewModel(MainModel) {DisplayName = "Overlays"});
-
- // By now Effects are added to the MainModel so we can savely start one
- ToggleEffects();
- }
-
- public bool EffectsEnabled
- {
- get { return MainModel.Enabled; }
- private set
- {
- MainModel.Enabled = value;
- NotifyOfPropertyChange(() => EffectsEnabled);
- }
- }
-
- public MainModel MainModel { get; set; }
-
- public void ToggleEffects()
- {
- if (EffectsEnabled)
- MainModel.ShutdownEffects();
- else
- MainModel.StartEffects();
-
- EffectsEnabled = !EffectsEnabled;
- }
-
- public void OnClose(EventArgs e)
- {
- MainModel.ShutdownEffects();
- Application.Current.Shutdown();
- }
- }
-}
\ No newline at end of file
diff --git a/Artemis/Artemis/ViewModels/ShellViewModel.cs b/Artemis/Artemis/ViewModels/ShellViewModel.cs
index ddf823867..5cf543d77 100644
--- a/Artemis/Artemis/ViewModels/ShellViewModel.cs
+++ b/Artemis/Artemis/ViewModels/ShellViewModel.cs
@@ -1,12 +1,59 @@
-using Caliburn.Micro;
+using System;
+using System.Windows;
+using Artemis.Models;
+using Caliburn.Micro;
+using MessageBox = System.Windows.Forms.MessageBox;
namespace Artemis.ViewModels
{
- internal sealed class SettingsViewModel : Conductor.Collection.OneActive
+ internal sealed class ShellViewModel : Conductor.Collection.OneActive
{
- public SettingsViewModel()
+ public ShellViewModel()
{
- DisplayName = "Artemis - Settings";
+ IEventAggregator events = new EventAggregator();
+ MainModel = new MainModel(events);
+
+ DisplayName = "Artemis";
+
+ ActivateItem(new EffectsViewModel(MainModel) {DisplayName = "Effects"});
+ ActivateItem(new GamesViewModel(MainModel) {DisplayName = "Games"});
+ ActivateItem(new OverlaysViewModel(MainModel) {DisplayName = "Overlays"});
+
+ // By now Effects are added to the MainModel so we can savely start one
+ ToggleEffects();
+ }
+
+ public bool EffectsEnabled
+ {
+ get { return MainModel.Enabled; }
+ private set
+ {
+ MainModel.Enabled = value;
+ NotifyOfPropertyChange(() => EffectsEnabled);
+ }
+ }
+
+ public MainModel MainModel { get; set; }
+
+ public void ToggleEffects()
+ {
+ if (EffectsEnabled)
+ MainModel.ShutdownEffects();
+ else
+ MainModel.StartEffects();
+
+ EffectsEnabled = !EffectsEnabled;
+ }
+
+ public void OnClose(EventArgs e)
+ {
+ MainModel.ShutdownEffects();
+ Application.Current.Shutdown();
+ }
+
+ public void ToggleSettings()
+ {
+ MessageBox.Show("Test");
}
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Views/Flyouts/FlyoutSettingsView.xaml b/Artemis/Artemis/Views/Flyouts/FlyoutSettingsView.xaml
new file mode 100644
index 000000000..8a7c28981
--- /dev/null
+++ b/Artemis/Artemis/Views/Flyouts/FlyoutSettingsView.xaml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Artemis/Artemis/Views/SettingsView.xaml b/Artemis/Artemis/Views/SettingsView.xaml
deleted file mode 100644
index b943d51c7..000000000
--- a/Artemis/Artemis/Views/SettingsView.xaml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
diff --git a/Artemis/Artemis/Views/SettingsView.xaml.cs b/Artemis/Artemis/Views/SettingsView.xaml.cs
deleted file mode 100644
index 519bc52c0..000000000
--- a/Artemis/Artemis/Views/SettingsView.xaml.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-
-namespace Artemis.Views
-{
- ///
- /// Interaction logic for SettingsView.xaml
- ///
- public partial class SettingsView : Window
- {
- public SettingsView()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/Artemis/Artemis/Views/ShellView.xaml b/Artemis/Artemis/Views/ShellView.xaml
index 13cc5b0c0..a9b3ae1f2 100644
--- a/Artemis/Artemis/Views/ShellView.xaml
+++ b/Artemis/Artemis/Views/ShellView.xaml
@@ -16,15 +16,19 @@
GlowBrush="{DynamicResource AccentColorBrush}">
-
-
-
-
-
+