Inheritance: PlatformFactoryBase
Exemple #1
0
        static Factory()
        {
            if (Configuration.Sdl2Supported) Default = new SDL2.Sdl2Factory();
            else if (Configuration.RunningOnWindows) Default = new Windows.WinFactory();
            else if (Configuration.RunningOnMacOS) Default = new MacOS.MacOSFactory();
            else if (Configuration.RunningOnX11) Default = new X11.X11Factory();
            else Default = new UnsupportedPlatform();

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

            if (Default is UnsupportedPlatform && !(Embedded is UnsupportedPlatform))
                Default = Embedded;
        }
Exemple #2
0
        static Factory()
        {
            if (Configuration.Sdl2Supported)
            {
                Default = new SDL2.Sdl2Factory();
            }
            else if (Configuration.RunningOnWindows)
            {
                Default = new Windows.WinFactory();
            }
            else if (Configuration.RunningOnMacOS)
            {
                Default = new MacOS.MacOSFactory();
            }
            else if (Configuration.RunningOnX11)
            {
                Default = new X11.X11Factory();
            }
            else
            {
                Default = new UnsupportedPlatform();
            }

            if (Configuration.Sdl2Supported)
            {
                Embedded = new Egl.EglSdl2PlatformFactory();
            }
            else if (Egl.Egl.IsSupported)
            {
                if (Configuration.RunningOnWindows)
                {
                    Embedded = new Egl.EglWinPlatformFactory();
                }
                else if (Configuration.RunningOnMacOS)
                {
                    Embedded = new Egl.EglMacPlatformFactory();
                }
                else if (Configuration.RunningOnX11)
                {
                    Embedded = new Egl.EglX11PlatformFactory();
                }
                else
                {
                    Embedded = new UnsupportedPlatform();
                }
            }
            else
            {
                Embedded = new UnsupportedPlatform();
            }

            if (Default is UnsupportedPlatform && !(Embedded is UnsupportedPlatform))
            {
                Default = Embedded;
            }
        }
Exemple #3
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;
        }
Exemple #4
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;
            }
        }
Exemple #5
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;
            }
        }