Beispiel #1
0
 private Sdl2GraphicsContext(IWindowInfo window)
 {
     // It is possible to create a GraphicsContext on a window
     // that is not owned by SDL (e.g. a GLControl). In that case,
     // we need to use SDL_CreateWindowFrom in order to
     // convert the foreign window to a SDL window.
     if (window is Sdl2WindowInfo)
     {
         Window = window;
     }
     else
     {
         Window = new Sdl2WindowInfo(
             SDL.CreateWindowFrom(window.Handle),
             null);
     }
 }
Beispiel #2
0
        public Sdl2NativeWindow(int x, int y, int width, int height,
                                string title, GameWindowFlags options, DisplayDevice device)
        {
            lock (sync)
            {
                SDL.DisableScreenSaver();

                var bounds = device.Bounds;
                var flags  = TranslateFlags(options);
                flags |= WindowFlags.OPENGL;
                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;
                }

                if ((flags & WindowFlags.RESIZABLE) == 0)
                {
                    window_border = WindowBorder.Fixed;
                }

                IntPtr handle;
                lock (SDL.Sync)
                {
                    handle = SDL.CreateWindow(title, bounds.Left + x, bounds.Top + y, width, height, flags);
                    exists = true;
                }
                ProcessEvents();
                window    = new Sdl2WindowInfo(handle, null);
                window_id = SDL.GetWindowID(handle);
                windows.Add(window_id, this);
            }
        }
Beispiel #3
0
 public Sdl2WindowInfo(IntPtr handle, Sdl2WindowInfo parent)
 {
     Handle = handle;
     Parent = parent;
 }