Inheritance: IWindowInfo
Ejemplo n.º 1
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;

                #if TIZEN
                flags |= WindowFlags.SHOWN;
                #else
                flags |= WindowFlags.HIDDEN;
                #endif

                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);

                #if TIZEN
                SDL.SetHint("SDL_IOS_ORIENTATIONS", "Portrait LandscapeLeft LandscapeRight PortraitUpsideDown");
                #endif
            }
        }
Ejemplo n.º 2
0
 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);
     }
 }
Ejemplo n.º 3
0
 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);
     }
 }
Ejemplo n.º 4
0
        public Sdl2NativeWindow(int x, int y, int width, int height,
                                string title, GameWindowFlags options, DisplayDevice device)
        {
            lock (sync)
            {
                var bounds = device.Bounds;
                var flags  = TranslateFlags(options);
                flags |= SDL.SDL_WindowFlags.SDL_WINDOW_OPENGL;
                flags |= SDL.SDL_WindowFlags.SDL_WINDOW_RESIZABLE;
                flags |= SDL.SDL_WindowFlags.SDL_WINDOW_HIDDEN;

                if ((flags & SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN_DESKTOP) != 0 ||
                    (flags & SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN) != 0)
                {
                    window_state = WindowState.Fullscreen;
                }

                IntPtr handle;
                lock (SDL.Sync)
                {
                    handle = SDL.SDL_CreateWindow(title, bounds.Left + x, bounds.Top + y, width, height, flags);
                    SDL.SDL_AddEventWatch(EventFilterDelegate, handle);
                    SDL.SDL_PumpEvents();
                }
                window    = new Sdl2WindowInfo(handle, null);
                window_id = SDL.SDL_GetWindowID(handle);
                windows.Add(window_id, this);
                window_title = title;

                keyboard.Description          = "Standard keyboard";
                keyboard.NumberOfFunctionKeys = 12;
                keyboard.NumberOfKeys         = 101;
                keyboard.NumberOfLeds         = 3;

                mouse.Description     = "Standard mouse";
                mouse.NumberOfButtons = 3;
                mouse.NumberOfWheels  = 1;

                keyboards.Add(keyboard);
                mice.Add(mouse);

                exists = true;
            }
        }
Ejemplo n.º 5
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)
                {
                    Console.Error.WriteLine($"Window Bound: [{bounds.Left + x}, {bounds.Top + y}, {width}, {height}]");
                    handle = SDL.CreateWindow(title, bounds.Left + x, bounds.Top + y, width, height, flags);
                    exists = true;
                }
#if !TIZEN
                ProcessEvents();
#endif
                window    = new Sdl2WindowInfo(handle, null);
                window_id = SDL.GetWindowID(handle);
                windows.Add(window_id, this);
            }
        }
Ejemplo n.º 6
0
        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;
            }
        }
Ejemplo n.º 7
0
 public Sdl2WindowInfo(IntPtr handle, Sdl2WindowInfo parent)
 {
     Handle = handle;
     Parent = parent;
 }
Ejemplo n.º 8
0
 public Sdl2WindowInfo(IntPtr handle, Sdl2WindowInfo parent)
 {
     Handle = handle;
     Parent = parent;
 }
Ejemplo n.º 9
0
        public Sdl2NativeWindow(int x, int y, int width, int height,
            string title, GameWindowFlags options, DisplayDevice device)
        {
            lock (sync)
            {
                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);
            }
        }
Ejemplo n.º 10
0
        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;
            }
        }
Ejemplo n.º 11
0
        public Sdl2NativeWindow(int x, int y, int width, int height,
            string title, GameWindowFlags options, DisplayDevice device)
        {
            lock (sync)
            {
                var bounds = device.Bounds;
                var flags = TranslateFlags(options);
                flags |= WindowFlags.OPENGL;
                flags |= WindowFlags.RESIZABLE;
                flags |= WindowFlags.HIDDEN;
                flags |= WindowFlags.ALLOW_HIGHDPI;

                if ((flags & WindowFlags.FULLSCREEN_DESKTOP) != 0 ||
                    (flags & WindowFlags.FULLSCREEN) != 0)
                    window_state = WindowState.Fullscreen;

                IntPtr handle;
                lock (SDL.Sync)
                {
                    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;
            }
        }
Ejemplo n.º 12
0
        public Sdl2NativeWindow(int x, int y, int width, int height,
            string title, GameWindowFlags options, DisplayDevice device)
        {
            lock (sync)
            {
                var bounds = device.Bounds;
                var flags = TranslateFlags(options);
                flags |= SDL.SDL_WindowFlags.SDL_WINDOW_OPENGL;
                flags |= SDL.SDL_WindowFlags.SDL_WINDOW_RESIZABLE;
                flags |= SDL.SDL_WindowFlags.SDL_WINDOW_HIDDEN;

                if ((flags & SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN_DESKTOP) != 0 ||
                    (flags & SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN) != 0)
                    window_state = WindowState.Fullscreen;

                IntPtr handle;
                lock (SDL.Sync)
                {
                    handle = SDL.SDL_CreateWindow(title, bounds.Left + x, bounds.Top + y, width, height, flags);
                    SDL.SDL_AddEventWatch(EventFilterDelegate, handle);
                    SDL.SDL_PumpEvents();
                }
                window = new Sdl2WindowInfo(handle, null);
                window_id = SDL.SDL_GetWindowID(handle);
                windows.Add(window_id, this);
                window_title = title;

                keyboard.Description = "Standard keyboard";
                keyboard.NumberOfFunctionKeys = 12;
                keyboard.NumberOfKeys = 101;
                keyboard.NumberOfLeds = 3;

                mouse.Description = "Standard mouse";
                mouse.NumberOfButtons = 3;
                mouse.NumberOfWheels = 1;

                keyboards.Add(keyboard);
                mice.Add(mouse);

                exists = true;
            }
        }