Esempio n. 1
0
        /// <summary>
        /// Initialize current instance with <paramref name="title"/> as the title of the Window.
        /// </summary>
        /// <param name="title">Title of the window, see Text property.</param>
        public Window(string title)
        {
            // Create the SDL window and then extract the native handle.
            SdlHandle = SDL.SDL_CreateWindow(title, SDL.SDL_WINDOWPOS_UNDEFINED, SDL.SDL_WINDOWPOS_UNDEFINED, 640, 480,
                                             SDL.SDL_WindowFlags.SDL_WINDOW_RESIZABLE | SDL.SDL_WindowFlags.SDL_WINDOW_HIDDEN);

            if (SdlHandle == IntPtr.Zero)
            {
                throw new Exception("Cannot allocate SDL Window: " + SDL.SDL_GetError());
            }
            else
            {
                SDL.SDL_SysWMinfo info = default(SDL.SDL_SysWMinfo);
                SDL.SDL_VERSION(out info.version);
                SDL.SDL_bool res = SDL.SDL_GetWindowWMInfo(SdlHandle, ref info);
                if (res == SDL.SDL_bool.SDL_FALSE)
                {
                    throw new Exception("Cannot get Window information: " + SDL.SDL_GetError());
                }
                else
                {
#if SILICONSTUDIO_PLATFORM_WINDOWS_DESKTOP
                    Handle = info.info.win.window;
#endif
                }
            }
            Application.RegisterWindow(this);
        }
Esempio n. 2
0
 public static bool ConvertFrom(SDL.SDL_bool Bool)
 {
     return(Bool == SDL.SDL_bool.SDL_TRUE);
 }
Esempio n. 3
0
 internal static bool ToBool(SDL.SDL_bool v)
 {
     return(v == SDL.SDL_bool.SDL_TRUE);
 }