상속: IPlatformFactory
예제 #1
0
파일: Factory.cs 프로젝트: hultqvist/opentk
        static Factory()
        {
            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 (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;
        }
예제 #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;
            }
        }
예제 #3
0
        static Factory()
        {
            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 (Egl.Egl.IsSupported)
            {
                if (Configuration.RunningOnWindows)
                {
                    Embedded = new Egl.EglWinPlatformFactory();
                }
                else if (Configuration.RunningOnMacOS)
                {
                    Embedded = new Egl.EglMacPlatformFactory();
                }
//#if RASPBERRYPI
//                else if (Configuration.RunningOnX11) Embedded = new Egl.EglPiPlatformFactory();
//#else
                else if (Configuration.RunningOnX11)
                {
                    Embedded = new Egl.EglX11PlatformFactory();
                }
//#endif
                else
                {
                    Embedded = new UnsupportedPlatform();
                }
            }
            else
            {
                Embedded = new UnsupportedPlatform();
            }

            //if (Default is UnsupportedPlatform && !(Embedded is UnsupportedPlatform))
            Default = Embedded;
        }
예제 #4
0
        static Factory2()
        {
            //----------------------------------------------
            if (Configuration.RunningOnWindows)
            {
                Default = new Windows.WinFactory(DesktopBackend.OpenGL);
            }
            else if (Configuration.RunningOnMacOS)
            {
                Default = new MacOS.MacOSFactory();
            }
            else if (Configuration.RunningOnX11)
            {
                Default = new X11.X11Factory();
            }
            else
            {
                Default = new UnsupportedPlatform();
            }

            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;
            }
        }
예제 #5
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;
        }
예제 #6
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;
            }
        }
예제 #7
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;
            }
        }
예제 #8
0
        static Factory()
        {
#if MOBILE
            if (Configuration.RunningOnAndroid)
            {
                Default = new Android.AndroidFactory();
            }
#else
            if (Configuration.RunningOnWindows)
            {
                Default = new Windows.WinFactory();
            }
            else if (Configuration.RunningOnMacOS)
            {
                Default = new MacOS.MacOSFactory();
            }
            else if (Configuration.RunningOnX11)
            {
                Default = new X11.X11Factory();
            }
#endif
            else
            {
                Default = new UnsupportedPlatform();
            }
            if (Egl.Egl.IsSupported)
            {
#if MOBILE
                if (Configuration.RunningOnAndroid)
                {
                    Embedded = new Egl.EglAndroidPlatformFactory();
                }
#else
                if (Configuration.RunningOnWindows)
                {
                    Embedded = new Egl.EglWinPlatformFactory();
                }
                else if (Configuration.RunningOnMacOS)
                {
                    Embedded = new Egl.EglMacPlatformFactory();
                }
                else if (Configuration.RunningOnX11)
                {
                    Embedded = new Egl.EglX11PlatformFactory();
                }
#endif
                else
                {
                    Embedded = new UnsupportedPlatform();
                }
            }
            else
            {
                Embedded = new UnsupportedPlatform();
            }

            if (Default is UnsupportedPlatform && !(Embedded is UnsupportedPlatform))
            {
                Default = Embedded;
            }
        }
예제 #9
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;
            }
        }