/// <summary>
        /// Creates a new window and attaches it to the current context.
        /// </summary>
        /// <param name="caption">The window's caption text.</param>
        /// <param name="x">The x-coordinate at which to position the window's top-left corner.</param>
        /// <param name="y">The y-coordinate at which to position the window's top-left corner.</param>
        /// <param name="width">The width of the window's client area in pixels.</param>
        /// <param name="height">The height of the window's client area in pixels.</param>
        /// <param name="flags">A set of WindowFlags values indicating how to create the window.</param>
        /// <returns>The Ultraviolet window that was created.</returns>
        public IUltravioletWindow Create(String caption, Int32 x, Int32 y, Int32 width, Int32 height, WindowFlags flags = WindowFlags.None)
        {
            var sdlflags = (renderingAPI == SDL2PlatformRenderingAPI.OpenGL) ? SDL_WINDOW_OPENGL : 0;

            if (Ultraviolet.Properties.SupportsHighDensityDisplayModes)
            {
                sdlflags |= SDL_WINDOW_ALLOW_HIGHDPI;
            }

            if ((flags & WindowFlags.Resizable) == WindowFlags.Resizable)
            {
                sdlflags |= SDL_WINDOW_RESIZABLE;
            }

            if ((flags & WindowFlags.Borderless) == WindowFlags.Borderless)
            {
                sdlflags |= SDL_WINDOW_BORDERLESS;
            }

            if ((flags & WindowFlags.Hidden) == WindowFlags.Hidden)
            {
                sdlflags |= SDL_WINDOW_HIDDEN;
            }
            else
            {
                sdlflags |= SDL_WINDOW_SHOWN;
            }

            var sdlptr = SDL_CreateWindow(caption ?? String.Empty,
                                          x == -1 ? (int)SDL_WINDOWPOS_CENTERED_MASK : x,
                                          y == -1 ? (int)SDL_WINDOWPOS_CENTERED_MASK : y,
                                          width, height, sdlflags);

            if (sdlptr == IntPtr.Zero)
            {
                throw new SDL2Exception();
            }

            var win = new SDL2UltravioletWindow(Ultraviolet, sdlptr);

            windows.Add(win);

            Ultraviolet.Messages.Subscribe(win, SDL2UltravioletMessages.SDLEvent);

            OnWindowCreated(win);

            return(win);
        }
        /// <summary>
        /// Creates a new Ultraviolet window from the specified native window and attaches it to the current context.
        /// </summary>
        /// <param name="ptr">A pointer that represents the native window to attach to the context.</param>
        /// <returns>The Ultraviolet window that was created.</returns>
        public IUltravioletWindow CreateFromNativePointer(IntPtr ptr)
        {
            var sdlptr = SDL_CreateWindowFrom(ptr);

            if (sdlptr == IntPtr.Zero)
            {
                throw new SDL2Exception();
            }

            var win = new SDL2UltravioletWindow(Ultraviolet, sdlptr);

            windows.Add(win);

            Ultraviolet.Messages.Subscribe(win, SDL2UltravioletMessages.SDLEvent);

            OnWindowCreated(win);

            return(win);
        }