Merge pull request #457 from Sergio0694/dev/resolution-scale-enabled

Disable resolution scale options when dynamic resolution is enabled
このコミットが含まれているのは:
Sergio Pedri authored and GitHub committed 2022-12-24 15:05:56 +01:00
コミット afa074bd09
7ファイル変更
+38 -9

検索条件に一致するファイルはありません

@@ -11,6 +11,7 @@
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)Constants\Error.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Constants\Event.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Converters\BoolConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Converters\RenderingPauseConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Converters\ResolutionScaleConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Services\DebugAnalyticsService.cs" />
+20
ファイルの表示
@@ -0,0 +1,20 @@
using System.Runtime.CompilerServices;
namespace ComputeSharp.SwapChain.Core.Converters;
/// <summary>
/// A class with some static converters for <see cref="bool"/> values.
/// </summary>
public static class BoolConverter
{
/// <summary>
/// Negates an input <see cref="bool"/> value.
/// </summary>
/// <param name="value">The <see cref="bool"/> value to negate.</param>
/// <returns>The negated value of <paramref name="value"/>.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool Not(bool value)
{
return !value;
}
}
+1 -1
ファイルの表示
@@ -14,7 +14,7 @@ public static class RenderingPauseConverter
/// <summary>
/// Gets a symbol for an input rendering state.
/// </summary>
/// <param name="value">Whether or not the rendering is currently paaused.</param>
/// <param name="value">Whether or not the rendering is currently paused.</param>
/// <returns>A symbol representing the next action for the rendering.</returns>
public static Symbol ConvertPausedToSymbol(bool value)
{
+1 -1
ファイルの表示
@@ -1,4 +1,4 @@
<Application
<Application
x:Class="ComputeSharp.SwapChain.Uwp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+5 -1
ファイルの表示
@@ -1,4 +1,4 @@
<UserControl
<UserControl
x:Class="ComputeSharp.SwapChain.Uwp.Views.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -196,21 +196,25 @@
Command="{x:Bind ViewModel.SetResolutionScaleCommand}"
CommandParameter="{x:Bind ViewModel.ResolutionScaleOptions[0]}"
IsChecked="{x:Bind ViewModel.SelectedResolutionScale.Equals(ViewModel.ResolutionScaleOptions[0]), Mode=OneWay}"
IsEnabled="{x:Bind converters:BoolConverter.Not(ViewModel.IsDynamicResolutionEnabled), Mode=OneWay}"
Text="{x:Bind converters:ResolutionScaleConverter.ConvertPercentageToFormattedString(ViewModel.ResolutionScaleOptions[0])}" />
<ToggleMenuFlyoutItem
Command="{x:Bind ViewModel.SetResolutionScaleCommand}"
CommandParameter="{x:Bind ViewModel.ResolutionScaleOptions[1]}"
IsChecked="{x:Bind ViewModel.SelectedResolutionScale.Equals(ViewModel.ResolutionScaleOptions[1]), Mode=OneWay}"
IsEnabled="{x:Bind converters:BoolConverter.Not(ViewModel.IsDynamicResolutionEnabled), Mode=OneWay}"
Text="{x:Bind converters:ResolutionScaleConverter.ConvertPercentageToFormattedString(ViewModel.ResolutionScaleOptions[1])}" />
<ToggleMenuFlyoutItem
Command="{x:Bind ViewModel.SetResolutionScaleCommand}"
CommandParameter="{x:Bind ViewModel.ResolutionScaleOptions[2]}"
IsChecked="{x:Bind ViewModel.SelectedResolutionScale.Equals(ViewModel.ResolutionScaleOptions[2]), Mode=OneWay}"
IsEnabled="{x:Bind converters:BoolConverter.Not(ViewModel.IsDynamicResolutionEnabled), Mode=OneWay}"
Text="{x:Bind converters:ResolutionScaleConverter.ConvertPercentageToFormattedString(ViewModel.ResolutionScaleOptions[2])}" />
<ToggleMenuFlyoutItem
Command="{x:Bind ViewModel.SetResolutionScaleCommand}"
CommandParameter="{x:Bind ViewModel.ResolutionScaleOptions[3]}"
IsChecked="{x:Bind ViewModel.SelectedResolutionScale.Equals(ViewModel.ResolutionScaleOptions[3]), Mode=OneWay}"
IsEnabled="{x:Bind converters:BoolConverter.Not(ViewModel.IsDynamicResolutionEnabled), Mode=OneWay}"
Text="{x:Bind converters:ResolutionScaleConverter.ConvertPercentageToFormattedString(ViewModel.ResolutionScaleOptions[3])}" />
</MenuFlyout>
</Button.Flyout>
+4 -4
ファイルの表示
@@ -1,4 +1,4 @@
<Application
<Application
x:Class="ComputeSharp.SwapChain.WinUI.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
@@ -8,9 +8,9 @@
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<ResourceDictionary>
<!-- Override the title bar colors to keep it transparent -->
<SolidColorBrush x:Key="WindowCaptionBackground" Color="Transparent"/>
<SolidColorBrush x:Key="WindowCaptionBackgroundDisabled" Color="Transparent"/>
<!-- Override the title bar colors to keep it transparent -->
<SolidColorBrush x:Key="WindowCaptionBackground" Color="Transparent" />
<SolidColorBrush x:Key="WindowCaptionBackgroundDisabled" Color="Transparent" />
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
+6 -2
ファイルの表示
@@ -1,4 +1,4 @@
<Window
<Window
x:Class="ComputeSharp.SwapChain.WinUI.Views.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -150,9 +150,9 @@
<computesharp:AnimatedComputeShaderPanel
x:Name="ShaderPanel"
Grid.Row="1"
IsVerticalSyncEnabled="{x:Bind ViewModel.IsVerticalSyncEnabled, Mode=OneWay}"
IsDynamicResolutionEnabled="{x:Bind ViewModel.IsDynamicResolutionEnabled, Mode=OneWay}"
IsPaused="{x:Bind ViewModel.IsRenderingPaused, Mode=OneWay}"
IsVerticalSyncEnabled="{x:Bind ViewModel.IsVerticalSyncEnabled, Mode=OneWay}"
ResolutionScale="{x:Bind converters:ResolutionScaleConverter.ConvertPercentageToScale(ViewModel.SelectedResolutionScale), Mode=OneWay}"
ShaderRunner="{x:Bind ViewModel.SelectedComputeShader.ShaderRunner, Mode=OneWay}" />
@@ -196,21 +196,25 @@
Command="{x:Bind ViewModel.SetResolutionScaleCommand}"
CommandParameter="{x:Bind ViewModel.ResolutionScaleOptions[0]}"
IsChecked="{x:Bind ViewModel.SelectedResolutionScale.Equals(ViewModel.ResolutionScaleOptions[0]), Mode=OneWay}"
IsEnabled="{x:Bind converters:BoolConverter.Not(ViewModel.IsDynamicResolutionEnabled), Mode=OneWay}"
Text="{x:Bind converters:ResolutionScaleConverter.ConvertPercentageToFormattedString(ViewModel.ResolutionScaleOptions[0])}" />
<ToggleMenuFlyoutItem
Command="{x:Bind ViewModel.SetResolutionScaleCommand}"
CommandParameter="{x:Bind ViewModel.ResolutionScaleOptions[1]}"
IsChecked="{x:Bind ViewModel.SelectedResolutionScale.Equals(ViewModel.ResolutionScaleOptions[1]), Mode=OneWay}"
IsEnabled="{x:Bind converters:BoolConverter.Not(ViewModel.IsDynamicResolutionEnabled), Mode=OneWay}"
Text="{x:Bind converters:ResolutionScaleConverter.ConvertPercentageToFormattedString(ViewModel.ResolutionScaleOptions[1])}" />
<ToggleMenuFlyoutItem
Command="{x:Bind ViewModel.SetResolutionScaleCommand}"
CommandParameter="{x:Bind ViewModel.ResolutionScaleOptions[2]}"
IsChecked="{x:Bind ViewModel.SelectedResolutionScale.Equals(ViewModel.ResolutionScaleOptions[2]), Mode=OneWay}"
IsEnabled="{x:Bind converters:BoolConverter.Not(ViewModel.IsDynamicResolutionEnabled), Mode=OneWay}"
Text="{x:Bind converters:ResolutionScaleConverter.ConvertPercentageToFormattedString(ViewModel.ResolutionScaleOptions[2])}" />
<ToggleMenuFlyoutItem
Command="{x:Bind ViewModel.SetResolutionScaleCommand}"
CommandParameter="{x:Bind ViewModel.ResolutionScaleOptions[3]}"
IsChecked="{x:Bind ViewModel.SelectedResolutionScale.Equals(ViewModel.ResolutionScaleOptions[3]), Mode=OneWay}"
IsEnabled="{x:Bind converters:BoolConverter.Not(ViewModel.IsDynamicResolutionEnabled), Mode=OneWay}"
Text="{x:Bind converters:ResolutionScaleConverter.ConvertPercentageToFormattedString(ViewModel.ResolutionScaleOptions[3])}" />
</MenuFlyout>
</Button.Flyout>