Mesen2/UI/Debugger/Views/ControllerInputView.axaml
2024-09-19 21:19:43 +09:00

82 lines
No EOL
4.7 KiB
XML

<UserControl
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:l="using:Mesen.Localization"
xmlns:u="using:Mesen.Utilities"
xmlns:dvm="using:Mesen.Debugger.ViewModels"
mc:Ignorable="d" d:DesignWidth="100" d:DesignHeight="60"
x:Name="root"
HorizontalAlignment="Stretch"
x:DataType="dvm:ControllerInputViewModel"
x:Class="Mesen.Debugger.Views.ControllerInputView"
>
<Design.DataContext>
<dvm:ControllerInputViewModel />
</Design.DataContext>
<UserControl.Styles>
<Style Selector="Button">
<Setter Property="MinWidth" Value="0" />
<Setter Property="MinHeight" Value="0" />
<Setter Property="Width" Value="8" />
<Setter Property="Height" Value="8" />
<Setter Property="Margin" Value="0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="#303030" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Command" Value="{Binding OnButtonClick}" />
</Style>
<Style Selector="Button:pointerover ContentPresenter">
<Setter Property="Background" Value="#FFFFFF" />
</Style>
<Style Selector="Button.selected">
<Setter Property="Background" Value="#FFFFFF" />
</Style>
</UserControl.Styles>
<Border BorderBrush="Gray" BorderThickness="1" Width="88" Height="{Binding ViewHeight}">
<Panel Background="#B0B0B0">
<Canvas Height="32" VerticalAlignment="Top" IsVisible="{Binding IsWs}">
<Button CommandParameter="U" Canvas.Top="4" Canvas.Left="10" Classes.selected="{Binding ButtonU}" />
<Button CommandParameter="L" Canvas.Top="12" Canvas.Left="2" Classes.selected="{Binding ButtonL}" />
<Rectangle Fill="Black" Canvas.Top="12" Canvas.Left="10" Width="8" Height="8" />
<Button CommandParameter="D" Canvas.Top="20" Canvas.Left="10" Classes.selected="{Binding ButtonD}" />
<Button CommandParameter="R" Canvas.Top="12" Canvas.Left="18" Classes.selected="{Binding ButtonR}" />
</Canvas>
<Canvas Height="30" VerticalAlignment="Bottom">
<TextBlock
Text="{Binding ControllerIndex}"
Canvas.Top="4"
Canvas.Left="0"
Foreground="Black"
Width="88"
TextAlignment="Center"
/>
<Button CommandParameter="Up" Canvas.Top="4" Canvas.Left="10" Classes.selected="{Binding ButtonUp}" />
<Button CommandParameter="Left" Canvas.Top="12" Canvas.Left="2" Classes.selected="{Binding ButtonLeft}" />
<Rectangle Fill="Black" Canvas.Top="12" Canvas.Left="10" Width="8" Height="8" />
<Button CommandParameter="Down" Canvas.Top="20" Canvas.Left="10" Classes.selected="{Binding ButtonDown}" />
<Button CommandParameter="Right" Canvas.Top="12" Canvas.Left="18" Classes.selected="{Binding ButtonRight}" />
<Button IsVisible="{Binding HasSelectButton}" CommandParameter="Select" Canvas.Top="20" Canvas.Left="32" Width="11" Height="7" Classes.selected="{Binding ButtonSelect}" CornerRadius="3" />
<Button IsVisible="{Binding HasStartButton}" CommandParameter="Start" Canvas.Top="20" Canvas.Left="45" Width="11" Height="7" Classes.selected="{Binding ButtonStart}" CornerRadius="3" />
</Canvas>
<Canvas IsVisible="{Binding !IsSnes}" Width="25" Height="15" HorizontalAlignment="Right" VerticalAlignment="Bottom">
<Button CommandParameter="B" Canvas.Top="0" Canvas.Left="0" Classes.selected="{Binding ButtonB}" CornerRadius="6" Width="10" Height="10" />
<Button CommandParameter="A" Canvas.Top="0" Canvas.Left="12" Classes.selected="{Binding ButtonA}" CornerRadius="6" Width="10" Height="10" />
</Canvas>
<Canvas IsVisible="{Binding IsSnes}" Width="26" Height="26" HorizontalAlignment="Right" VerticalAlignment="Bottom">
<Button CommandParameter="X" Canvas.Top="0" Canvas.Left="8" Classes.selected="{Binding ButtonX}" CornerRadius="6" Width="9" Height="9"/>
<Button CommandParameter="Y" Canvas.Top="8" Canvas.Left="0" Classes.selected="{Binding ButtonY}" CornerRadius="6" Width="9" Height="9" />
<Button CommandParameter="B" Canvas.Top="16" Canvas.Left="8" Classes.selected="{Binding ButtonB}" CornerRadius="6" Width="9" Height="9" />
<Button CommandParameter="A" Canvas.Top="8" Canvas.Left="16" Classes.selected="{Binding ButtonA}" CornerRadius="6" Width="9" Height="9" />
</Canvas>
<Canvas IsVisible="{Binding HasShoulderButtons}" Width="86" Height="4" Margin="0 -1 0 0" VerticalAlignment="Top">
<Button CommandParameter="L" Canvas.Top="0" Canvas.Left="6" Height="5" Width="16" Classes.selected="{Binding ButtonL}" />
<Button CommandParameter="R" Canvas.Top="0" Canvas.Left="64" Height="5" Width="16" Classes.selected="{Binding ButtonR}" />
</Canvas>
</Panel>
</Border>
</UserControl>