diff --git a/src/Ryujinx/UI/Controls/ControllerOverlay.axaml b/src/Ryujinx/UI/Controls/ControllerOverlay.axaml deleted file mode 100644 index 0208e8853..000000000 --- a/src/Ryujinx/UI/Controls/ControllerOverlay.axaml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/src/Ryujinx/UI/Controls/ControllerOverlay.axaml.cs b/src/Ryujinx/UI/Controls/ControllerOverlay.axaml.cs deleted file mode 100644 index 8799050ef..000000000 --- a/src/Ryujinx/UI/Controls/ControllerOverlay.axaml.cs +++ /dev/null @@ -1,149 +0,0 @@ -using Avalonia.Controls; -using Avalonia.Media; -using Avalonia.Threading; -using Ryujinx.Common.Configuration.Hid; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Ryujinx.Ava.UI.Controls -{ - public partial class ControllerOverlay : UserControl - { - - public ControllerOverlay() - { - InitializeComponent(); - Background = Brushes.Transparent; - HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Right; - VerticalAlignment = Avalonia.Layout.VerticalAlignment.Top; - Margin = new Avalonia.Thickness(0, 50, 20, 0); - } - - public void ShowControllerBindings(List inputConfigs, int durationSeconds = 3) - { - // Clear existing bindings - PlayerBindings.Children.Clear(); - - // Group controllers by player index - var playerBindings = new Dictionary>(); - - foreach (var config in inputConfigs.Where(c => c.PlayerIndex <= PlayerIndex.Player4)) - { - if (!playerBindings.ContainsKey(config.PlayerIndex)) - { - playerBindings[config.PlayerIndex] = new List(); - } - playerBindings[config.PlayerIndex].Add(config); - } - - // Add player bindings to UI - for (int i = 0; i < 4; i++) - { - var playerIndex = (PlayerIndex)i; - var playerPanel = new StackPanel { Orientation = Avalonia.Layout.Orientation.Horizontal, Spacing = 12 }; - - // Player number with colored background - var playerNumberBorder = new Border - { - Background = GetPlayerColor(i), - CornerRadius = new Avalonia.CornerRadius(12), - Padding = new Avalonia.Thickness(8, 4), - VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center - }; - - var playerLabel = new TextBlock - { - Text = $"P{i + 1}", - FontWeight = FontWeight.Bold, - Foreground = Brushes.White, - FontSize = 12, - HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Center - }; - playerNumberBorder.Child = playerLabel; - playerPanel.Children.Add(playerNumberBorder); - - if (playerBindings.ContainsKey(playerIndex)) - { - var controllers = playerBindings[playerIndex]; - var controllerNames = controllers.Select(c => GetControllerDisplayName(c)).ToList(); - - var controllerText = new TextBlock - { - Text = string.Join(", ", controllerNames), - Foreground = Brushes.LightGreen, - VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center, - FontWeight = FontWeight.SemiBold - }; - playerPanel.Children.Add(controllerText); - } - else - { - var noControllerText = new TextBlock - { - Text = "No controller assigned", - Foreground = Brushes.Gray, - VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center, - FontStyle = FontStyle.Italic - }; - playerPanel.Children.Add(noControllerText); - } - - PlayerBindings.Children.Add(playerPanel); - } - - // Update duration text - DurationText.Text = durationSeconds == 1 - ? "This overlay will disappear in 1 second" - : $"This overlay will disappear in {durationSeconds} seconds"; - - // Show the overlay - IsVisible = true; - - // Auto-hide after delay - _ = Task.Run(async () => - { - await Task.Delay(durationSeconds * 1000); - await Dispatcher.UIThread.InvokeAsync(() => - { - IsVisible = false; - }); - }); - } - - private static IBrush GetPlayerColor(int playerIndex) - { - return playerIndex switch - { - 0 => new SolidColorBrush(Color.FromRgb(255, 92, 92)), // Red for Player 1 - 1 => new SolidColorBrush(Color.FromRgb(54, 162, 235)), // Blue for Player 2 - 2 => new SolidColorBrush(Color.FromRgb(255, 206, 84)), // Yellow for Player 3 - 3 => new SolidColorBrush(Color.FromRgb(75, 192, 192)), // Green for Player 4 - _ => new SolidColorBrush(Color.FromRgb(128, 128, 128)) // Gray fallback - }; - } - - private static string GetControllerDisplayName(InputConfig config) - { - if (string.IsNullOrEmpty(config.Name)) - { - return config.Backend switch - { - InputBackendType.WindowKeyboard => "Keyboard", - InputBackendType.GamepadSDL2 => "Controller", - _ => "Unknown" - }; - } - - // Truncate long controller names - string name = config.Name; - if (name.Length > 25) - { - name = name.Substring(0, 22) + "..."; - } - - return name; - } - } -}