Reuse Sdl2Factory.InputDriver in Sdl2NativeWindow
This commit is contained in:
parent
a72d70c3d0
commit
1d61bd9dd2
2 changed files with 7 additions and 4 deletions
|
@ -34,7 +34,7 @@ namespace OpenTK.Platform.SDL2
|
|||
{
|
||||
class Sdl2Factory : IPlatformFactory
|
||||
{
|
||||
readonly IInputDriver2 InputDriver = new Sdl2InputDriver();
|
||||
readonly Sdl2InputDriver InputDriver = new Sdl2InputDriver();
|
||||
bool disposed;
|
||||
|
||||
/// <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)
|
||||
{
|
||||
return new Sdl2NativeWindow(x, y, width, height, title, options, device);
|
||||
return new Sdl2NativeWindow(x, y, width, height, title, options, device, InputDriver);
|
||||
}
|
||||
|
||||
public IDisplayDeviceDriver CreateDisplayDeviceDriver()
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace OpenTK.Platform.SDL2
|
|||
// Argument for KeyDown and KeyUp events (allocated once to avoid runtime allocations)
|
||||
readonly KeyboardKeyEventArgs key_args = new KeyboardKeyEventArgs();
|
||||
|
||||
readonly IInputDriver input_driver = new Sdl2InputDriver();
|
||||
readonly IInputDriver input_driver;
|
||||
|
||||
readonly EventFilter EventFilterDelegate_GCUnsafe = FilterEvents;
|
||||
readonly IntPtr EventFilterDelegate;
|
||||
|
@ -81,10 +81,13 @@ namespace OpenTK.Platform.SDL2
|
|||
static readonly Sdl2KeyMap map = new Sdl2KeyMap();
|
||||
|
||||
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)
|
||||
{
|
||||
this.input_driver = input_driver;
|
||||
|
||||
var bounds = device.Bounds;
|
||||
var flags = TranslateFlags(options);
|
||||
flags |= WindowFlags.OPENGL;
|
||||
|
|
Loading…
Reference in a new issue