mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-05-06 06:57:43 +02:00

* misc: Move Ryujinx project to Ryujinx.Gtk3 This breaks release CI for now but that's fine. Signed-off-by: Mary Guillemard <mary@mary.zone> * misc: Move Ryujinx.Ava project to Ryujinx This breaks CI for now, but it's fine. Signed-off-by: Mary Guillemard <mary@mary.zone> * infra: Make Avalonia the default UI Should fix CI after the previous changes. GTK3 isn't build by the release job anymore, only by PR CI. This also ensure that the test-ava update package is still generated to allow update from the old testing channel. Signed-off-by: Mary Guillemard <mary@mary.zone> * Fix missing copy in create_app_bundle.sh Signed-off-by: Mary Guillemard <mary@mary.zone> * Fix syntax error Signed-off-by: Mary Guillemard <mary@mary.zone> --------- Signed-off-by: Mary Guillemard <mary@mary.zone>
68 lines
1.8 KiB
C#
68 lines
1.8 KiB
C#
using Avalonia;
|
|
using Avalonia.Controls;
|
|
using Ryujinx.Common.Configuration;
|
|
using Ryujinx.UI.Common.Configuration;
|
|
using System;
|
|
|
|
namespace Ryujinx.Ava.UI.Renderer
|
|
{
|
|
public partial class RendererHost : UserControl, IDisposable
|
|
{
|
|
public readonly EmbeddedWindow EmbeddedWindow;
|
|
|
|
public event EventHandler<EventArgs> WindowCreated;
|
|
public event Action<object, Size> BoundsChanged;
|
|
|
|
public RendererHost()
|
|
{
|
|
InitializeComponent();
|
|
|
|
if (ConfigurationState.Instance.Graphics.GraphicsBackend.Value == GraphicsBackend.OpenGl)
|
|
{
|
|
EmbeddedWindow = new EmbeddedWindowOpenGL();
|
|
}
|
|
else
|
|
{
|
|
EmbeddedWindow = new EmbeddedWindowVulkan();
|
|
}
|
|
|
|
Initialize();
|
|
}
|
|
|
|
private void Initialize()
|
|
{
|
|
EmbeddedWindow.WindowCreated += CurrentWindow_WindowCreated;
|
|
EmbeddedWindow.BoundsChanged += CurrentWindow_BoundsChanged;
|
|
|
|
Content = EmbeddedWindow;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
if (EmbeddedWindow != null)
|
|
{
|
|
EmbeddedWindow.WindowCreated -= CurrentWindow_WindowCreated;
|
|
EmbeddedWindow.BoundsChanged -= CurrentWindow_BoundsChanged;
|
|
}
|
|
|
|
GC.SuppressFinalize(this);
|
|
}
|
|
|
|
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
|
|
{
|
|
base.OnDetachedFromVisualTree(e);
|
|
|
|
Dispose();
|
|
}
|
|
|
|
private void CurrentWindow_BoundsChanged(object sender, Size e)
|
|
{
|
|
BoundsChanged?.Invoke(sender, e);
|
|
}
|
|
|
|
private void CurrentWindow_WindowCreated(object sender, IntPtr e)
|
|
{
|
|
WindowCreated?.Invoke(this, EventArgs.Empty);
|
|
}
|
|
}
|
|
}
|