mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-12-28 11:33:06 +00:00
Polish the aesthetic and include deadzone visualization.
This commit is contained in:
parent
0682f6eea9
commit
d01c67f7bf
2 changed files with 70 additions and 36 deletions
|
@ -3,6 +3,7 @@ using Ryujinx.Ava.Input;
|
||||||
using Ryujinx.Ava.UI.Models.Input;
|
using Ryujinx.Ava.UI.Models.Input;
|
||||||
using Ryujinx.Ava.UI.Views.Input;
|
using Ryujinx.Ava.UI.Views.Input;
|
||||||
using Ryujinx.Input;
|
using Ryujinx.Input;
|
||||||
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
@ -11,8 +12,8 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||||
public class ControllerInputViewModel : BaseModel
|
public class ControllerInputViewModel : BaseModel
|
||||||
{
|
{
|
||||||
private const int StickUiPollMs = 50; // Milliseconds per poll.
|
private const int StickUiPollMs = 50; // Milliseconds per poll.
|
||||||
private const float CanvasCenterOffset = 75f/2f;
|
private const float CanvasCenterOffset = 47.5f;
|
||||||
private const int StickScaleFactor = 30;
|
private const int StickScaleFactor = 45;
|
||||||
|
|
||||||
private IGamepad _selectedGamepad;
|
private IGamepad _selectedGamepad;
|
||||||
|
|
||||||
|
@ -81,6 +82,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||||
OnPropertyChanged();
|
OnPropertyChanged();
|
||||||
OnPropertyChanged(nameof(UiStickRightX));
|
OnPropertyChanged(nameof(UiStickRightX));
|
||||||
OnPropertyChanged(nameof(UiStickRightY));
|
OnPropertyChanged(nameof(UiStickRightY));
|
||||||
|
OnPropertyChanged(nameof(UiDeadzoneRight));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,6 +96,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||||
OnPropertyChanged();
|
OnPropertyChanged();
|
||||||
OnPropertyChanged(nameof(UiStickLeftX));
|
OnPropertyChanged(nameof(UiStickLeftX));
|
||||||
OnPropertyChanged(nameof(UiStickLeftY));
|
OnPropertyChanged(nameof(UiStickLeftY));
|
||||||
|
OnPropertyChanged(nameof(UiDeadzoneLeft));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,6 +107,9 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||||
public float UiStickRightX => UiStickRight.Item1 + CanvasCenterOffset;
|
public float UiStickRightX => UiStickRight.Item1 + CanvasCenterOffset;
|
||||||
public float UiStickRightY => UiStickRight.Item2 + CanvasCenterOffset;
|
public float UiStickRightY => UiStickRight.Item2 + CanvasCenterOffset;
|
||||||
|
|
||||||
|
public float UiDeadzoneLeft => Config.DeadzoneLeft * 95;
|
||||||
|
public float UiDeadzoneRight => Config.DeadzoneRight * 95;
|
||||||
|
|
||||||
public readonly InputViewModel ParentModel;
|
public readonly InputViewModel ParentModel;
|
||||||
|
|
||||||
public ControllerInputViewModel(InputViewModel model, GamepadInputConfig config)
|
public ControllerInputViewModel(InputViewModel model, GamepadInputConfig config)
|
||||||
|
|
|
@ -333,56 +333,84 @@
|
||||||
BorderBrush="{DynamicResource ThemeControlBorderColor}"
|
BorderBrush="{DynamicResource ThemeControlBorderColor}"
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
CornerRadius="5"
|
CornerRadius="5"
|
||||||
Height="100"
|
Height="105"
|
||||||
Width="100">
|
Width="105">
|
||||||
<Canvas
|
<Canvas
|
||||||
Background="{DynamicResource ThemeBackgroundColor}"
|
Background="{DynamicResource ThemeBackgroundColor}"
|
||||||
Height="100"
|
Height="100"
|
||||||
Width="100">
|
Width="100">
|
||||||
|
<Grid
|
||||||
|
Height="100"
|
||||||
|
Width="100"
|
||||||
|
Background="{DynamicResource ThemeBackgroundColor}">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Ellipse
|
||||||
|
Grid.Column="1"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Stroke="Black"
|
||||||
|
StrokeThickness="1"
|
||||||
|
Width="100"
|
||||||
|
Height="100"
|
||||||
|
Canvas.Bottom="2"
|
||||||
|
Canvas.Left="2" />
|
||||||
|
<Ellipse
|
||||||
|
Grid.Column="1"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Fill="Gray"
|
||||||
|
Opacity="100"
|
||||||
|
Height="{Binding UiDeadzoneLeft}"
|
||||||
|
Width="{Binding UiDeadzoneLeft}"/>
|
||||||
|
</Grid>
|
||||||
<Ellipse
|
<Ellipse
|
||||||
Fill="Gray"
|
Fill="Red"
|
||||||
Stroke="Blue"
|
Width="5"
|
||||||
StrokeThickness="1"
|
Height="5"
|
||||||
Width="25"
|
Canvas.Bottom="{Binding UiStickLeftY}"
|
||||||
Height="25"
|
Canvas.Left="{Binding UiStickLeftX}" />
|
||||||
Canvas.Bottom="{Binding UiStickLeftY}"
|
|
||||||
Canvas.Left="{Binding UiStickLeftX}" />
|
|
||||||
<Ellipse
|
|
||||||
Stroke="Black"
|
|
||||||
StrokeThickness="1"
|
|
||||||
StrokeDashOffset="2"
|
|
||||||
Width="96"
|
|
||||||
Height="96"
|
|
||||||
Canvas.Bottom="2"
|
|
||||||
Canvas.Left="2" />
|
|
||||||
</Canvas>
|
</Canvas>
|
||||||
</Border>
|
</Border>
|
||||||
<Border
|
<Border
|
||||||
BorderBrush="{DynamicResource ThemeControlBorderColor}"
|
BorderBrush="{DynamicResource ThemeControlBorderColor}"
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
CornerRadius="5"
|
CornerRadius="5"
|
||||||
Height="100"
|
Height="105"
|
||||||
Width="100">
|
Width="105">
|
||||||
<Canvas
|
<Canvas
|
||||||
Background="{DynamicResource ThemeBackgroundColor}"
|
Background="{DynamicResource ThemeBackgroundColor}"
|
||||||
Height="100"
|
Height="100"
|
||||||
Width="100">
|
Width="100">
|
||||||
|
<Grid
|
||||||
|
Height="100"
|
||||||
|
Width="100"
|
||||||
|
Background="{DynamicResource ThemeBackgroundColor}">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Ellipse
|
||||||
|
Grid.Column="1"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Stroke="Black"
|
||||||
|
StrokeThickness="1"
|
||||||
|
Width="100"
|
||||||
|
Height="100"
|
||||||
|
Canvas.Bottom="2"
|
||||||
|
Canvas.Left="2" />
|
||||||
|
<Ellipse
|
||||||
|
Grid.Column="1"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Fill="Gray"
|
||||||
|
Opacity="100"
|
||||||
|
Height="{Binding UiDeadzoneRight}"
|
||||||
|
Width="{Binding UiDeadzoneRight}"/>
|
||||||
|
</Grid>
|
||||||
<Ellipse
|
<Ellipse
|
||||||
Fill="Gray"
|
Fill="Red"
|
||||||
Stroke="Blue"
|
Width="5"
|
||||||
StrokeThickness="1"
|
Height="5"
|
||||||
Width="25"
|
Canvas.Bottom="{Binding UiStickRightY}"
|
||||||
Height="25"
|
Canvas.Left="{Binding UiStickRightX}" />
|
||||||
Canvas.Bottom="{Binding UiStickRightY}"
|
|
||||||
Canvas.Left="{Binding UiStickRightX}"/>
|
|
||||||
<Ellipse
|
|
||||||
Stroke="Black"
|
|
||||||
StrokeThickness="1"
|
|
||||||
StrokeDashOffset="2"
|
|
||||||
Width="96"
|
|
||||||
Height="96"
|
|
||||||
Canvas.Bottom="2"
|
|
||||||
Canvas.Left="2" />
|
|
||||||
</Canvas>
|
</Canvas>
|
||||||
</Border>
|
</Border>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
Loading…
Reference in a new issue