mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-08 22:18:47 +00:00
25 lines
641 B
C#
25 lines
641 B
C#
|
using Avalonia.OpenGL;
|
||
|
using SPB.Graphics.OpenGL;
|
||
|
using System;
|
||
|
|
||
|
namespace Ryujinx.Ava.Ui.Controls
|
||
|
{
|
||
|
public static class IGlContextExtension
|
||
|
{
|
||
|
public static OpenGLContextBase AsOpenGLContextBase(this IGlContext context)
|
||
|
{
|
||
|
var handle = (IntPtr)context.GetType().GetProperty("Handle").GetValue(context);
|
||
|
|
||
|
if (OperatingSystem.IsWindows())
|
||
|
{
|
||
|
return new AvaloniaWglContext(handle);
|
||
|
}
|
||
|
else if (OperatingSystem.IsLinux())
|
||
|
{
|
||
|
return new AvaloniaGlxContext(handle);
|
||
|
}
|
||
|
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
}
|