diff --git a/Artemis/Artemis/Profiles/Layers/Types/AmbientLight/ScreenCapturing/ScreenCaptureManager.cs b/Artemis/Artemis/Profiles/Layers/Types/AmbientLight/ScreenCapturing/ScreenCaptureManager.cs index d40a5e818..92fe05ef5 100644 --- a/Artemis/Artemis/Profiles/Layers/Types/AmbientLight/ScreenCapturing/ScreenCaptureManager.cs +++ b/Artemis/Artemis/Profiles/Layers/Types/AmbientLight/ScreenCapturing/ScreenCaptureManager.cs @@ -20,7 +20,7 @@ namespace Artemis.Profiles.Layers.Types.AmbientLight.ScreenCapturing private static IScreenCapture _screenCapture; public static double StandByTime { get; set; } = 3; - public static double UpdateRate { get; set; } = 1f / 20f; // DarthAffe 29.10.2016: I think 20 FPS should be enough as default + public static double UpdateRate { get; set; } = 1.0 / 20.0; // DarthAffe 29.10.2016: I think 20 FPS should be enough as default public static ScreenCaptureMode ScreenCaptureMode { get; set; } = ScreenCaptureMode.DirectX9; public static int LastCaptureWidth { get; private set; } @@ -33,7 +33,7 @@ namespace Artemis.Profiles.Layers.Types.AmbientLight.ScreenCapturing private static IScreenCapture GetScreenCapture() { - if (_lastScreenCaptureMode == ScreenCaptureMode) + if (_lastScreenCaptureMode == ScreenCaptureMode && _screenCapture != null) return _screenCapture; DisposeScreenCapture(); diff --git a/Artemis/Artemis/Settings/GeneralSettings.cs b/Artemis/Artemis/Settings/GeneralSettings.cs index 189bb025f..b8cf81ee0 100644 --- a/Artemis/Artemis/Settings/GeneralSettings.cs +++ b/Artemis/Artemis/Settings/GeneralSettings.cs @@ -3,6 +3,7 @@ using System.ComponentModel; using System.IO; using System.Windows; using Artemis.DAL; +using Artemis.Profiles.Layers.Types.AmbientLight.ScreenCapturing; using Artemis.Utilities; using Caliburn.Micro; using MahApps.Metro; @@ -59,6 +60,10 @@ namespace Artemis.Settings [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)] public string Theme { get; set; } + [DefaultValue(20)] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)] + public int ScreenCaptureFPS { get; set; } + [DefaultValue("Info")] [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)] public string LogLevel { get; set; } @@ -71,6 +76,7 @@ namespace Artemis.Settings ApplyAutorun(); ApplyTheme(); ApplyGamestatePort(); + ApplyScreenCaptureFPS(); Logging.SetupLogging(LogLevel); } @@ -109,7 +115,7 @@ namespace Artemis.Settings { // Ignored, only happens when running from VS } - + } } @@ -138,5 +144,10 @@ namespace Artemis.Settings } }); } + + public void ApplyScreenCaptureFPS() + { + ScreenCaptureManager.UpdateRate = 1.0 / ScreenCaptureFPS; + } } } \ No newline at end of file diff --git a/Artemis/Artemis/Views/Flyouts/FlyoutSettingsView.xaml b/Artemis/Artemis/Views/Flyouts/FlyoutSettingsView.xaml index b61361692..8b50fe0dc 100644 --- a/Artemis/Artemis/Views/Flyouts/FlyoutSettingsView.xaml +++ b/Artemis/Artemis/Views/Flyouts/FlyoutSettingsView.xaml @@ -6,8 +6,7 @@ xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" xmlns:cal="http://www.caliburnproject.org" mc:Ignorable="d" - d:DesignHeight="600" d:DesignWidth="300" - Width="270"> + d:DesignHeight="600" d:DesignWidth="300"> @@ -25,6 +24,7 @@ + @@ -89,27 +89,33 @@ Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}" HorizontalAlignment="Right" /> + +