public Sdl2InputDriver() { lock (SDL.Sync) { SDL.GameControllerEventState(EventState.Enable); SDL.JoystickEventState(EventState.Enable); EventFilterDelegate = Marshal.GetFunctionPointerForDelegate(EventFilterDelegate_GCUnsafe); driver_handle = new IntPtr(count++); DriverHandles.Add(driver_handle, this); SDL.AddEventWatch(EventFilterDelegate, driver_handle); if (SDL.InitSubSystem(SystemFlags.HAPTIC) < 0) { Debug.Print("[SDL2] InputDriver failed to init Haptic subsystem. Error: {0}", SDL.GetError()); } if (SDL.InitSubSystem(SystemFlags.JOYSTICK) < 0) { Debug.Print("[SDL2] InputDriver failed to init Joystick subsystem. Error: {0}", SDL.GetError()); } if (SDL.InitSubSystem(SystemFlags.GAMECONTROLLER) < 0) { Debug.Print("[SDL2] InputDriver failed to init GameController subsystem. Error: {0}", SDL.GetError()); } } }
public Sdl2InputDriver() { lock (SDL.Sync) { EventFilterDelegate = Marshal.GetFunctionPointerForDelegate(EventFilterDelegate_GCUnsafe); driver_handle = new IntPtr(count++); DriverHandles.Add(driver_handle, this); SDL.AddEventWatch(EventFilterDelegate, driver_handle); } }
public Sdl2NativeWindow(int x, int y, int width, int height, 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; flags |= WindowFlags.RESIZABLE; flags |= WindowFlags.HIDDEN; if (Toolkit.Options.EnableHighResolution) { flags |= WindowFlags.ALLOW_HIGHDPI; } if ((flags & WindowFlags.FULLSCREEN_DESKTOP) != 0 || (flags & WindowFlags.FULLSCREEN) != 0) { window_state = WindowState.Fullscreen; } IntPtr handle; lock (SDL.Sync) { EventFilterDelegate = Marshal.GetFunctionPointerForDelegate(EventFilterDelegate_GCUnsafe); handle = SDL.CreateWindow(title, bounds.Left + x, bounds.Top + y, width, height, flags); SDL.AddEventWatch(EventFilterDelegate, handle); SDL.PumpEvents(); } window = new Sdl2WindowInfo(handle, null); window_id = SDL.GetWindowID(handle); windows.Add(window_id, this); window_title = title; exists = true; } }