当前位置: 首页>>代码示例>>C#>>正文


C# WindowMode类代码示例

本文整理汇总了C#中WindowMode的典型用法代码示例。如果您正苦于以下问题:C# WindowMode类的具体用法?C# WindowMode怎么用?C# WindowMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WindowMode类属于命名空间,在下文中一共展示了WindowMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetMode

        void SetMode(WindowMode mode)
        {
            if (mode == WindowMode.Fullscreen)
            {
                Settings.DeviceMode = DeviceMode.Fullscreen;
                Settings.Resolution = new Resolution
                {
                    Width = 1440,
                    Height = 900
                };
            }
            else
                Settings.DeviceMode = DeviceMode.Windowed;

            if (mode == WindowMode.Windowed)
            {
                window.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
                window.WindowState = System.Windows.Forms.FormWindowState.Normal;
                //Settings.Resolution = new Resolution
                //{
                //    Width = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Size.
                //};
            }
            else
            {
                window.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                window.WindowState = System.Windows.Forms.FormWindowState.Maximized;
            }

            WindowMode = mode;

            GraphicsDevice.ApplySettings();
        }
开发者ID:ChristianMarchiori,项目名称:DeadMeetsLead,代码行数:33,代码来源:Program.cs

示例2: Sdl2GraphicsDevice

        public Sdl2GraphicsDevice(Size windowSize, WindowMode windowMode)
        {
            size = windowSize;

            SDL.SDL_Init(SDL.SDL_INIT_NOPARACHUTE | SDL.SDL_INIT_VIDEO);
            SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_DOUBLEBUFFER, 1);
            SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_RED_SIZE, 8);
            SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_GREEN_SIZE, 8);
            SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_BLUE_SIZE, 8);
            SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_ALPHA_SIZE, 0);

            SDL.SDL_DisplayMode display;
            SDL.SDL_GetCurrentDisplayMode(0, out display);

            Console.WriteLine("Desktop resolution: {0}x{1}", display.w, display.h);
            if (size.Width == 0 && size.Height == 0)
            {
                Console.WriteLine("No custom resolution provided, using desktop resolution");
                size = new Size(display.w, display.h);
            }

            Console.WriteLine("Using resolution: {0}x{1}", size.Width, size.Height);

            window = SDL.SDL_CreateWindow("OpenRA", SDL.SDL_WINDOWPOS_CENTERED, SDL.SDL_WINDOWPOS_CENTERED, size.Width, size.Height, SDL.SDL_WindowFlags.SDL_WINDOW_OPENGL);

            if (windowMode == WindowMode.Fullscreen)
                SDL.SDL_SetWindowFullscreen(window, (uint)SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN);
            else if (windowMode == WindowMode.PseudoFullscreen)
            {
                // Work around a visual glitch in OSX: the window is offset
                // partially offscreen if the dock is at the left of the screen
                if (Platform.CurrentPlatform == PlatformType.OSX)
                    SDL.SDL_SetWindowPosition(window, 0, 0);

                SDL.SDL_SetWindowFullscreen(window, (uint)SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN_DESKTOP);
                SDL.SDL_SetHint(SDL.SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
            }

            SDL.SDL_ShowCursor(0);
            context = SDL.SDL_GL_CreateContext(window);
            SDL.SDL_GL_MakeCurrent(window, context);
            GL.LoadAll();
            ErrorHandler.CheckGlVersion();
            ErrorHandler.CheckGlError();

            if (SDL.SDL_GL_ExtensionSupported("GL_EXT_framebuffer_object") == SDL.SDL_bool.SDL_FALSE)
            {
                ErrorHandler.WriteGraphicsLog("OpenRA requires the OpenGL extension GL_EXT_framebuffer_object.\n"
                    +"Please try updating your GPU driver to the latest version provided by the manufacturer.");
                throw new InvalidProgramException("Missing OpenGL extension GL_EXT_framebuffer_object. See graphics.log for details.");
            }

            GL.EnableClientState(ArrayCap.VertexArray);
            ErrorHandler.CheckGlError();
            GL.EnableClientState(ArrayCap.TextureCoordArray);
            ErrorHandler.CheckGlError();

            SDL.SDL_SetModState(0);
            input = new Sdl2Input();
        }
开发者ID:RunCraze,项目名称:OpenRA,代码行数:60,代码来源:Sdl2GraphicsDevice.cs

示例3: GraphicsDevice

		public GraphicsDevice( Size size, WindowMode window )
		{
			Console.WriteLine("Using Cg renderer");
			windowSize = size;

			var extensions = new string[]
			{
				"GL_ARB_vertex_program",
				"GL_ARB_fragment_program",
				"GL_ARB_vertex_buffer_object",
			};

			surf = SdlGraphics.InitializeSdlGl(ref windowSize, window, extensions);

			cgContext = Tao.Cg.Cg.cgCreateContext();

			Tao.Cg.Cg.cgSetErrorCallback( CgErrorCallback );

			Tao.Cg.CgGl.cgGLRegisterStates( cgContext );
			Tao.Cg.CgGl.cgGLSetManageTextureParameters( cgContext, true );
			vertexProfile = CgGl.cgGLGetLatestProfile( CgGl.CG_GL_VERTEX );
			fragmentProfile = CgGl.cgGLGetLatestProfile( CgGl.CG_GL_FRAGMENT );

			Gl.glEnableClientState( Gl.GL_VERTEX_ARRAY );
			ErrorHandler.CheckGlError();
			Gl.glEnableClientState( Gl.GL_TEXTURE_COORD_ARRAY );
			ErrorHandler.CheckGlError();

			Sdl.SDL_SetModState( 0 );	// i have had enough.

			input = new SdlInput( surf );
		}
开发者ID:hoxworth,项目名称:OpenRA,代码行数:32,代码来源:GraphicsDevice.cs

示例4: GraphicsDevice

        public GraphicsDevice( int width, int height, WindowMode window, bool vsync )
        {
            Console.WriteLine("Using Gl renderer");
            Sdl.SDL_Init( Sdl.SDL_INIT_NOPARACHUTE | Sdl.SDL_INIT_VIDEO );
            Sdl.SDL_GL_SetAttribute( Sdl.SDL_GL_DOUBLEBUFFER, 1 );
            Sdl.SDL_GL_SetAttribute( Sdl.SDL_GL_RED_SIZE, 8 );
            Sdl.SDL_GL_SetAttribute( Sdl.SDL_GL_GREEN_SIZE, 8 );
            Sdl.SDL_GL_SetAttribute( Sdl.SDL_GL_BLUE_SIZE, 8 );
            Sdl.SDL_GL_SetAttribute( Sdl.SDL_GL_ALPHA_SIZE, 0 );

            int windowFlags = 0;
            switch( window )
            {
            case WindowMode.Fullscreen:
                windowFlags |= Sdl.SDL_FULLSCREEN;
                break;
            case WindowMode.PseudoFullscreen:
                windowFlags |= Sdl.SDL_NOFRAME;
                Environment.SetEnvironmentVariable( "SDL_VIDEO_WINDOW_POS", "0,0" );
                break;
            default:
                break;
            }

            surf = Sdl.SDL_SetVideoMode( width, height, 0, Sdl.SDL_OPENGL | windowFlags );

            Sdl.SDL_WM_SetCaption( "OpenRA", "OpenRA" );
            Sdl.SDL_ShowCursor( 0 );
            Sdl.SDL_EnableUNICODE( 1 );
            Sdl.SDL_EnableKeyRepeat( Sdl.SDL_DEFAULT_REPEAT_DELAY, Sdl.SDL_DEFAULT_REPEAT_INTERVAL );

            CheckGlError();

            // Test for required extensions
            var required = new string[]
            {
                "GL_ARB_vertex_shader",
                "GL_ARB_fragment_shader",
                "GL_ARB_vertex_buffer_object",
            };

            var extensions = Gl.glGetString(Gl.GL_EXTENSIONS);
            if (required.Any(r => !extensions.Contains(r)))
            {
                Log.AddChannel("graphics", "graphics.log");
                Log.Write("graphics", "Unsupported GPU: Missing extensions.");
                Log.Write("graphics", "Available extensions:");
                Log.Write("graphics", extensions);
                throw new InvalidProgramException("Unsupported GPU. See graphics.log for details.");
            }

            windowSize = new Size( width, height );

            Gl.glEnableClientState( Gl.GL_VERTEX_ARRAY );
            CheckGlError();
            Gl.glEnableClientState( Gl.GL_TEXTURE_COORD_ARRAY );
            CheckGlError();

            Sdl.SDL_SetModState( 0 );
        }
开发者ID:djohe,项目名称:OpenRA,代码行数:60,代码来源:GraphicsDevice.cs

示例5: Sdl2GraphicsDevice

        public Sdl2GraphicsDevice(Size windowSize, WindowMode windowMode)
        {
            Console.WriteLine("Using SDL 2 with OpenGL renderer");
            WindowSize = windowSize;

            SDL.SDL_Init(SDL.SDL_INIT_NOPARACHUTE | SDL.SDL_INIT_VIDEO);
            SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_DOUBLEBUFFER, 1);
            SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_RED_SIZE, 8);
            SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_GREEN_SIZE, 8);
            SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_BLUE_SIZE, 8);
            SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_ALPHA_SIZE, 0);

            SDL.SDL_DisplayMode display;
            SDL.SDL_GetCurrentDisplayMode(0, out display);

            Console.WriteLine("Desktop resolution: {0}x{1}", display.w, display.h);
            if (WindowSize.Width == 0 && WindowSize.Height == 0)
            {
                Console.WriteLine("No custom resolution provided, using desktop resolution");
                WindowSize = new Size(display.w, display.h);
            }

            Console.WriteLine("Using resolution: {0}x{1}", WindowSize.Width, WindowSize.Height);

            window = SDL.SDL_CreateWindow("OpenRA", SDL.SDL_WINDOWPOS_CENTERED, SDL.SDL_WINDOWPOS_CENTERED,
                WindowSize.Width, WindowSize.Height, SDL.SDL_WindowFlags.SDL_WINDOW_OPENGL);

            if (Game.Settings.Game.LockMouseWindow)
                GrabWindowMouseFocus();
            else
                ReleaseWindowMouseFocus();

            if (windowMode == WindowMode.Fullscreen)
                SDL.SDL_SetWindowFullscreen(window, (uint)SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN);
            else if (windowMode == WindowMode.PseudoFullscreen)
            {
                // Work around a visual glitch in OSX: the window is offset
                // partially offscreen if the dock is at the left of the screen
                if (Platform.CurrentPlatform == PlatformType.OSX)
                    SDL.SDL_SetWindowPosition(window, 0, 0);

                SDL.SDL_SetWindowFullscreen(window, (uint)SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN_DESKTOP);
                SDL.SDL_SetHint(SDL.SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
            }

            context = SDL.SDL_GL_CreateContext(window);
            if (context == IntPtr.Zero || SDL.SDL_GL_MakeCurrent(window, context) < 0)
                throw new InvalidOperationException("Can not create OpenGL context. (Error: {0})".F(SDL.SDL_GetError()));

            OpenGL.Initialize();

            OpenGL.glEnableVertexAttribArray(Shader.VertexPosAttributeIndex);
            OpenGL.CheckGLError();
            OpenGL.glEnableVertexAttribArray(Shader.TexCoordAttributeIndex);
            OpenGL.CheckGLError();

            SDL.SDL_SetModState(SDL.SDL_Keymod.KMOD_NONE);
            input = new Sdl2Input();
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:59,代码来源:Sdl2GraphicsDevice.cs

示例6: Sdl2GraphicsDevice

        public Sdl2GraphicsDevice(Size windowSize, WindowMode windowMode)
        {
            size = windowSize;

            SDL.SDL_Init(SDL.SDL_INIT_NOPARACHUTE | SDL.SDL_INIT_VIDEO);
            SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_DOUBLEBUFFER, 1);
            SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_RED_SIZE, 8);
            SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_GREEN_SIZE, 8);
            SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_BLUE_SIZE, 8);
            SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_ALPHA_SIZE, 0);

            var windowFlags = SDL.SDL_WindowFlags.SDL_WINDOW_OPENGL;
            if (windowMode == WindowMode.Fullscreen)
                windowFlags |= SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN;
            else if (windowMode == WindowMode.PseudoFullscreen)
            {
                windowFlags |= SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN_DESKTOP;
                Environment.SetEnvironmentVariable("SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS", "0");
            }

            SDL.SDL_DisplayMode display;
            SDL.SDL_GetCurrentDisplayMode(0, out display);

            Console.WriteLine("Desktop resolution: {0}x{1}", display.w, display.h);
            if (size.Width == 0 && size.Height == 0)
            {
                Console.WriteLine("No custom resolution provided, using desktop resolution");
                size = new Size(display.w, display.h);
            }

            Console.WriteLine("Using resolution: {0}x{1}", size.Width, size.Height);

            window = SDL.SDL_CreateWindow("OpenRA", SDL.SDL_WINDOWPOS_CENTERED, SDL.SDL_WINDOWPOS_CENTERED, size.Width, size.Height, windowFlags);

            SDL.SDL_ShowCursor(0);
            SDL.SDL_GL_CreateContext(window);
            ErrorHandler.CheckGlError();

            var extensions = Gl.glGetString(Gl.GL_EXTENSIONS);
            if (extensions == null)
                Console.WriteLine("Failed to fetch GL_EXTENSIONS, this is bad.");

            var missingExtensions = requiredExtensions.Where(r => !extensions.Contains(r)).ToArray();
            if (missingExtensions.Any())
            {
                ErrorHandler.WriteGraphicsLog("Unsupported GPU: Missing extensions: {0}".F(missingExtensions.JoinWith(",")));
                throw new InvalidProgramException("Unsupported GPU. See graphics.log for details.");
            }

            Gl.glEnableClientState(Gl.GL_VERTEX_ARRAY);
            ErrorHandler.CheckGlError();
            Gl.glEnableClientState(Gl.GL_TEXTURE_COORD_ARRAY);
            ErrorHandler.CheckGlError();

            SDL.SDL_SetModState(0);
            input = new Sdl2Input();
        }
开发者ID:Generalcamo,项目名称:OpenRA,代码行数:57,代码来源:Sdl2GraphicsDevice.cs

示例7: GLFWWindow

 public GLFWWindow(int width, int height, int rbits, int gbits, int bbits, int alpha, int depth, int stencil, WindowMode mode)
 {
     _width = width;
     _height = height;
     _rbits = rbits;
     _gbits = gbits;
     _bbits = bbits;
     _alpha = alpha;
     _depth = depth;
     _stencil = stencil;
     _mode = mode;
 }
开发者ID:veggielane,项目名称:CasualScience,代码行数:12,代码来源:GLFWWindow.cs

示例8: GraphicsDevice

		public GraphicsDevice(Size size, WindowMode window)
			: base(size, window, RequiredExtensions)
		{
			cgContext = Tao.Cg.Cg.cgCreateContext();

			Tao.Cg.Cg.cgSetErrorCallback(CgErrorCallback);

			Tao.Cg.CgGl.cgGLRegisterStates(cgContext);
			Tao.Cg.CgGl.cgGLSetManageTextureParameters(cgContext, true);
			vertexProfile = CgGl.cgGLGetLatestProfile(CgGl.CG_GL_VERTEX);
			fragmentProfile = CgGl.cgGLGetLatestProfile(CgGl.CG_GL_FRAGMENT);
		}
开发者ID:nevelis,项目名称:OpenRA,代码行数:12,代码来源:GraphicsDevice.cs

示例9: NamedWindow

 /// <summary>
 /// Creates a window.
 /// </summary>
 /// <param name="winname">Name of the window in the window caption that may be used as a window identifier.</param>
 /// <param name="flags">
 /// Flags of the window. Currently the only supported flag is CV WINDOW AUTOSIZE. If this is set, 
 /// the window size is automatically adjusted to fit the displayed image (see imshow ), and the user can not change the window size manually.
 /// </param>
 public static void NamedWindow(string winname, WindowMode flags)
 {
     if (string.IsNullOrEmpty(winname))
         throw new ArgumentNullException("winname");
     try
     {
         NativeMethods.highgui_namedWindow(winname, (int)flags);
     }
     catch (BadImageFormatException ex)
     {
         throw PInvokeHelper.CreateException(ex);
     }
 }
开发者ID:jorik041,项目名称:opencvsharp,代码行数:21,代码来源:Cv2_highgui.cs

示例10: SdlGraphics

        public SdlGraphics(Size size, WindowMode window, string[] extensions)
        {
            windowSize = size;
            InitializeSdlGl(ref windowSize, window, extensions);

            Gl.glEnableClientState(Gl.GL_VERTEX_ARRAY);
            ErrorHandler.CheckGlError();
            Gl.glEnableClientState(Gl.GL_TEXTURE_COORD_ARRAY);
            ErrorHandler.CheckGlError();

            Sdl.SDL_SetModState(0);

            input = new SdlInput();
        }
开发者ID:TiriliPiitPiit,项目名称:OpenRA,代码行数:14,代码来源:SdlGraphics.cs

示例11: GraphicsDevice

        public GraphicsDevice( int width, int height, WindowMode window, bool vsync )
        {
            Console.WriteLine("Using Gl renderer");
            Sdl.SDL_Init( Sdl.SDL_INIT_NOPARACHUTE | Sdl.SDL_INIT_VIDEO );
            Sdl.SDL_GL_SetAttribute( Sdl.SDL_GL_DOUBLEBUFFER, 1 );
            Sdl.SDL_GL_SetAttribute( Sdl.SDL_GL_RED_SIZE, 8 );
            Sdl.SDL_GL_SetAttribute( Sdl.SDL_GL_GREEN_SIZE, 8 );
            Sdl.SDL_GL_SetAttribute( Sdl.SDL_GL_BLUE_SIZE, 8 );
            Sdl.SDL_GL_SetAttribute( Sdl.SDL_GL_ALPHA_SIZE, 0 );

            int windowFlags = 0;
            switch( window )
            {
            case WindowMode.Fullscreen:
                windowFlags |= Sdl.SDL_FULLSCREEN;
                break;
            case WindowMode.PseudoFullscreen:
                // pseudo-fullscreen only reliably works on windows; fall back to fullscreen for everyone else
                windowFlags |= ( Environment.OSVersion.Platform == PlatformID.Win32NT ) ? Sdl.SDL_NOFRAME : Sdl.SDL_FULLSCREEN;
                Environment.SetEnvironmentVariable( "SDL_VIDEO_WINDOW_POS", "0,0" );
                break;
            default:
                break;
            }

            surf = Sdl.SDL_SetVideoMode( width, height, 0, Sdl.SDL_OPENGL | windowFlags );

            Sdl.SDL_WM_SetCaption( "OpenRA", "OpenRA" );
            Sdl.SDL_ShowCursor( 0 );
            Sdl.SDL_EnableUNICODE( 1 );
            Sdl.SDL_EnableKeyRepeat( Sdl.SDL_DEFAULT_REPEAT_DELAY, Sdl.SDL_DEFAULT_REPEAT_INTERVAL );

            CheckGlError();

            windowSize = new Size( width, height );

            Gl.glEnableClientState( Gl.GL_VERTEX_ARRAY );
            CheckGlError();
            Gl.glEnableClientState( Gl.GL_TEXTURE_COORD_ARRAY );
            CheckGlError();

            Sdl.SDL_SetModState( 0 );	// i have had enough.

            var extensions = Gl.glGetString(Gl.GL_EXTENSIONS);

            if (!extensions.Contains("GL_ARB_vertex_shader") || !extensions.Contains("GL_ARB_fragment_shader"))
                throw new InvalidProgramException("Unsupported GPU. OpenRA requires the GL_ARB_vertex_shader and GL_ARB_fragment_shader extensions.");
        }
开发者ID:geckosoft,项目名称:OpenRA,代码行数:48,代码来源:GraphicsDevice.cs

示例12: Settings

        static Settings()
        {
            int screenWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
            int screenHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
            appDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Constants.APP_DATA_GAME_NAME);

            // General
            _windowMode = WindowMode.Fullscreen;
            _startingGameState = GameState.MainMenu;
            _X_resolution = screenWidth;
            _Y_resolution = screenHeight;
            _X_windowPos = 0;
            _Y_windowPos = 0;
            _mouseVisible = true;
            _fixedTimestep = false;
            _mouseScrolling = true;
            // Audio
            _masterVolume = 1.0f;
            _effectVolume = 1.0f;
            _musicVolume = 0.5f;
        }
开发者ID:MitchJH,项目名称:BaseBuilder,代码行数:21,代码来源:Settings.cs

示例13: CreateGraphics

		public IGraphicsDevice CreateGraphics(Size size, WindowMode windowMode)
		{
			return new NullGraphicsDevice(size, windowMode);
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:4,代码来源:NullPlatform.cs

示例14: InitializeSdlGl

        IntPtr InitializeSdlGl(ref Size size, WindowMode window, string[] requiredExtensions)
        {
            Sdl.SDL_Init(Sdl.SDL_INIT_NOPARACHUTE | Sdl.SDL_INIT_VIDEO);
            Sdl.SDL_GL_SetAttribute(Sdl.SDL_GL_DOUBLEBUFFER, 1);
            Sdl.SDL_GL_SetAttribute(Sdl.SDL_GL_RED_SIZE, 8);
            Sdl.SDL_GL_SetAttribute(Sdl.SDL_GL_GREEN_SIZE, 8);
            Sdl.SDL_GL_SetAttribute(Sdl.SDL_GL_BLUE_SIZE, 8);
            Sdl.SDL_GL_SetAttribute(Sdl.SDL_GL_ALPHA_SIZE, 0);

            int windowFlags = 0;
            switch (window)
            {
            case WindowMode.Fullscreen:
                windowFlags |= Sdl.SDL_FULLSCREEN;
                break;
            case WindowMode.PseudoFullscreen:
                windowFlags |= Sdl.SDL_NOFRAME;
                Environment.SetEnvironmentVariable("SDL_VIDEO_WINDOW_POS", "0,0");
                break;
            case WindowMode.Windowed:
                Environment.SetEnvironmentVariable("SDL_VIDEO_CENTERED", "1");
                break;
            default:
                break;
            }

            var info = (Sdl.SDL_VideoInfo)Marshal.PtrToStructure(
                Sdl.SDL_GetVideoInfo(), typeof(Sdl.SDL_VideoInfo));
            Console.WriteLine("Desktop resolution: {0}x{1}",
                info.current_w, info.current_h);

            if (size.Width == 0 && size.Height == 0)
            {
                Console.WriteLine("No custom resolution provided, using desktop resolution");
                size = new Size(info.current_w, info.current_h);
            }

            Console.WriteLine("Using resolution: {0}x{1}", size.Width, size.Height);

            var surf = Sdl.SDL_SetVideoMode(size.Width, size.Height, 0, Sdl.SDL_OPENGL | windowFlags);
            if (surf == IntPtr.Zero)
                Console.WriteLine("Failed to set video mode.");

            Sdl.SDL_WM_SetCaption("OpenRA", "OpenRA");
            Sdl.SDL_ShowCursor(0);
            Sdl.SDL_EnableUNICODE(1);
            Sdl.SDL_EnableKeyRepeat(Sdl.SDL_DEFAULT_REPEAT_DELAY, Sdl.SDL_DEFAULT_REPEAT_INTERVAL);

            ErrorHandler.CheckGlError();

            var extensions = Gl.glGetString(Gl.GL_EXTENSIONS);
            if (extensions == null)
                Console.WriteLine("Failed to fetch GL_EXTENSIONS, this is bad.");

            var missingExtensions = requiredExtensions.Where(r => !extensions.Contains(r)).ToArray();

            if (missingExtensions.Any())
            {
                ErrorHandler.WriteGraphicsLog("Unsupported GPU: Missing extensions: {0}"
                    .F(missingExtensions.JoinWith(",")));
                throw new InvalidProgramException("Unsupported GPU. See graphics.log for details.");
            }

            return surf;
        }
开发者ID:TiriliPiitPiit,项目名称:OpenRA,代码行数:65,代码来源:SdlGraphics.cs

示例15: cvNamedWindow

 public static extern int cvNamedWindow([MarshalAs(UnmanagedType.LPStr)] string name, WindowMode flags);
开发者ID:sanglin307,项目名称:UnityOpenCV,代码行数:1,代码来源:CvInvoke.cs


注:本文中的WindowMode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。