mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 18:55:50 +00:00
Reuse Sdl2Factory.InputDriver in Sdl2NativeWindow
This commit is contained in:
parent
a72d70c3d0
commit
1d61bd9dd2
|
@ -34,7 +34,7 @@ namespace OpenTK.Platform.SDL2
|
||||||
{
|
{
|
||||||
class Sdl2Factory : IPlatformFactory
|
class Sdl2Factory : IPlatformFactory
|
||||||
{
|
{
|
||||||
readonly IInputDriver2 InputDriver = new Sdl2InputDriver();
|
readonly Sdl2InputDriver InputDriver = new Sdl2InputDriver();
|
||||||
bool disposed;
|
bool disposed;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -58,7 +58,7 @@ namespace OpenTK.Platform.SDL2
|
||||||
|
|
||||||
public INativeWindow CreateNativeWindow(int x, int y, int width, int height, string title, GraphicsMode mode, GameWindowFlags options, DisplayDevice device)
|
public INativeWindow CreateNativeWindow(int x, int y, int width, int height, string title, GraphicsMode mode, GameWindowFlags options, DisplayDevice device)
|
||||||
{
|
{
|
||||||
return new Sdl2NativeWindow(x, y, width, height, title, options, device);
|
return new Sdl2NativeWindow(x, y, width, height, title, options, device, InputDriver);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDisplayDeviceDriver CreateDisplayDeviceDriver()
|
public IDisplayDeviceDriver CreateDisplayDeviceDriver()
|
||||||
|
|
|
@ -70,7 +70,7 @@ namespace OpenTK.Platform.SDL2
|
||||||
// Argument for KeyDown and KeyUp events (allocated once to avoid runtime allocations)
|
// Argument for KeyDown and KeyUp events (allocated once to avoid runtime allocations)
|
||||||
readonly KeyboardKeyEventArgs key_args = new KeyboardKeyEventArgs();
|
readonly KeyboardKeyEventArgs key_args = new KeyboardKeyEventArgs();
|
||||||
|
|
||||||
readonly IInputDriver input_driver = new Sdl2InputDriver();
|
readonly IInputDriver input_driver;
|
||||||
|
|
||||||
readonly EventFilter EventFilterDelegate_GCUnsafe = FilterEvents;
|
readonly EventFilter EventFilterDelegate_GCUnsafe = FilterEvents;
|
||||||
readonly IntPtr EventFilterDelegate;
|
readonly IntPtr EventFilterDelegate;
|
||||||
|
@ -81,10 +81,13 @@ namespace OpenTK.Platform.SDL2
|
||||||
static readonly Sdl2KeyMap map = new Sdl2KeyMap();
|
static readonly Sdl2KeyMap map = new Sdl2KeyMap();
|
||||||
|
|
||||||
public Sdl2NativeWindow(int x, int y, int width, int height,
|
public Sdl2NativeWindow(int x, int y, int width, int height,
|
||||||
string title, GameWindowFlags options, DisplayDevice device)
|
string title, GameWindowFlags options, DisplayDevice device,
|
||||||
|
IInputDriver input_driver)
|
||||||
{
|
{
|
||||||
lock (sync)
|
lock (sync)
|
||||||
{
|
{
|
||||||
|
this.input_driver = input_driver;
|
||||||
|
|
||||||
var bounds = device.Bounds;
|
var bounds = device.Bounds;
|
||||||
var flags = TranslateFlags(options);
|
var flags = TranslateFlags(options);
|
||||||
flags |= WindowFlags.OPENGL;
|
flags |= WindowFlags.OPENGL;
|
||||||
|
|
Loading…
Reference in a new issue