Beispiel #1
0
        public Factory()
        {
            // Ensure we are correctly initialized.
            Toolkit.Init();

            // Create regular platform backend
            if (Configuration.RunningOnSdl2) Default = new SDL2.Sdl2Factory();
            else if (Configuration.RunningOnX11) Default = new X11.X11Factory();
            else if (Configuration.RunningOnLinux) Default = new Linux.LinuxFactory();
            else if (Configuration.RunningOnWindows) Default = new Windows.WinFactory();
            else if (Configuration.RunningOnMacOS) Default = new MacOS.MacOSFactory();
            else Default = new UnsupportedPlatform();

            // Create embedded platform backend for EGL / OpenGL ES.
            // Todo: we could probably delay this until the embedded
            // factory is actually accessed. This might improve startup
            // times slightly.
            if (Configuration.RunningOnSdl2)
            {
                // SDL supports both EGL and desktop backends
                // using the same API.
                Embedded = Default;
            }
            else if (Egl.Egl.IsSupported)
            {
                if (Configuration.RunningOnLinux) Embedded = Default;
                else if (Configuration.RunningOnX11) Embedded = new Egl.EglX11PlatformFactory();
                else if (Configuration.RunningOnWindows) Embedded = new Egl.EglWinPlatformFactory();
                else if (Configuration.RunningOnMacOS) Embedded = new Egl.EglMacPlatformFactory();
                else Embedded = new UnsupportedPlatform();
            }
            else
            {
                Embedded = new UnsupportedPlatform();
            }

            if (Default is UnsupportedPlatform && !(Embedded is UnsupportedPlatform))
                Default = Embedded;
        }
Beispiel #2
0
        public Factory()
        {
            // Ensure we are correctly initialized.
            Toolkit.Init();

            // Create regular platform backend
            if (Configuration.RunningOnSdl2)
            {
                Default = new SDL2.Sdl2Factory();
            }
            else if (Configuration.RunningOnX11)
            {
                Default = new X11.X11Factory();
            }
            else if (Configuration.RunningOnLinux)
            {
                Default = new Linux.LinuxFactory();
            }
            else if (Configuration.RunningOnWindows)
            {
                Default = new Windows.WinFactory();
            }
            else if (Configuration.RunningOnMacOS)
            {
                Default = new MacOS.MacOSFactory();
            }
            else
            {
                Default = new UnsupportedPlatform();
            }

            // Create embedded platform backend for EGL / OpenGL ES.
            // Todo: we could probably delay this until the embedded
            // factory is actually accessed. This might improve startup
            // times slightly.
            if (Configuration.RunningOnSdl2)
            {
                // SDL supports both EGL and desktop backends
                // using the same API.
                Embedded = Default;
            }
            else if (Egl.Egl.IsSupported)
            {
                if (Configuration.RunningOnLinux)
                {
                    Embedded = Default;
                }
                else if (Configuration.RunningOnX11)
                {
                    Embedded = new Egl.EglX11PlatformFactory();
                }
                else if (Configuration.RunningOnWindows)
                {
                    Embedded = new Egl.EglWinPlatformFactory();
                }
                else if (Configuration.RunningOnMacOS)
                {
                    Embedded = new Egl.EglMacPlatformFactory();
                }
                else
                {
                    Embedded = new UnsupportedPlatform();
                }
            }
            else
            {
                Embedded = new UnsupportedPlatform();
            }

            if (Default is UnsupportedPlatform && !(Embedded is UnsupportedPlatform))
            {
                Default = Embedded;
            }
        }
Beispiel #3
0
        public Factory()
        {
            // Ensure we are correctly initialized.
            Toolkit.Init();

            // Create regular platform backend
#if SDL2
            if (Configuration.RunningOnSdl2)
            {
                Default = new SDL2.Sdl2Factory();
            }
#endif
#if WIN32
            else if (Configuration.RunningOnWindows)
            {
                Default = new Windows.WinFactory();
            }
#endif
#if CARBON
            else if (Configuration.RunningOnMacOS)
            {
                Default = new MacOS.MacOSFactory();
            }
#endif
#if X11
            else if (Configuration.RunningOnX11)
            {
                Default = new X11.X11Factory();
            }
            else if (Configuration.RunningOnLinux)
            {
                Default = new Linux.LinuxFactory();
            }
#endif
            if (Default == null)
            {
                Default = new UnsupportedPlatform();
            }

            // Create embedded platform backend for EGL / OpenGL ES.
            // Todo: we could probably delay this until the embedded
            // factory is actually accessed. This might improve startup
            // times slightly.
            if (Configuration.RunningOnSdl2)
            {
                // SDL supports both EGL and desktop backends
                // using the same API.
                Embedded = Default;
            }
#if IPHONE
            else if (Configuration.RunningOnIOS)
            {
                Embedded = new iPhoneOS.iPhoneFactory();
            }
#else
            else if (Egl.Egl.IsSupported)
            {
                if (Configuration.RunningOnLinux)
                {
                    Embedded = Default;
                }
#if X11
                else if (Configuration.RunningOnX11)
                {
                    Embedded = new Egl.EglX11PlatformFactory();
                }
#endif
#if WIN32
                else if (Configuration.RunningOnWindows)
                {
                    Embedded = new Egl.EglWinPlatformFactory();
                }
#endif
#if CARBON
                else if (Configuration.RunningOnMacOS)
                {
                    Embedded = new Egl.EglMacPlatformFactory();
                }
#endif
#if ANDROID
                else if (Configuration.RunningOnAndroid)
                {
                    Embedded = new Android.AndroidFactory();
                }
#endif
                else
                {
                    Embedded = new UnsupportedPlatform();
                }

#if ANDROID
                Angle = new UnsupportedPlatform();
#else
                Angle = new Egl.EglAnglePlatformFactory(Embedded);
#endif
            }
#endif
            else
            {
                Embedded = new UnsupportedPlatform();
                Angle    = Embedded;
            }

            if (Default is UnsupportedPlatform && !(Embedded is UnsupportedPlatform))
            {
                Default = Embedded;
            }
        }
Beispiel #4
0
        public Factory()
        {
            // Ensure we are correctly initialized.
            Toolkit.Init();

            // Create regular platform backend
            if (Configuration.RunningOnWindows)
            {
                Default = new Windows.WinFactory();
            }
            else if (Configuration.RunningOnMacOS)
            {
                Default = new MacOS.MacOSFactory();
            }
            else if (Configuration.RunningOnX11)
            {
                Default = new X11.X11Factory();
            }
            else if (Configuration.RunningOnLinux)
            {
                Default = new Linux.LinuxFactory();
            }
            if (Default == null)
            {
                Default = new UnsupportedPlatform();
            }

            if (Egl.Egl.IsSupported)
            {
                if (Configuration.RunningOnLinux)
                {
                    Embedded = Default;
                }
                else if (Configuration.RunningOnX11)
                {
                    Embedded = new Egl.EglX11PlatformFactory();
                }
                else if (Configuration.RunningOnWindows)
                {
                    Embedded = new Egl.EglWinPlatformFactory();
                }
                else if (Configuration.RunningOnMacOS)
                {
                    Embedded = new Egl.EglMacPlatformFactory();
                }
                else
                {
                    Embedded = new UnsupportedPlatform();
                }
                Angle = new Egl.EglAnglePlatformFactory(Embedded);
            }
            else
            {
                Embedded = new UnsupportedPlatform();
                Angle    = Embedded;
            }

            if (Default is UnsupportedPlatform && !(Embedded is UnsupportedPlatform))
            {
                Default = Embedded;
            }
        }