• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# WindowMode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Create

 public IGraphicsDevice Create(Size size, WindowMode windowMode)
 {
     Console.WriteLine("Using SDL 2 with OpenGL renderer");
     return new Sdl2GraphicsDevice(size, windowMode);
 }
开发者ID:RobotCaleb,项目名称:OpenRA,代码行数:5,代码来源:Sdl2GraphicsDevice.cs


示例17: ViewGcodeBasic

		public ViewGcodeBasic(PrintItemWrapper printItem, Vector3 viewerVolume, Vector2 bedCenter, BedShape bedShape, WindowMode windowMode)
		{
			this.viewerVolume = viewerVolume;
			this.bedShape = bedShape;
			this.bedCenter = bedCenter;
			this.windowMode = windowMode;
			this.printItem = printItem;

			if (UserSettings.Instance.DisplayMode == ApplicationDisplayType.Touchscreen)
			{
				sliderWidth = 20;
			}
			else
			{
				sliderWidth = 10;
			}

			CreateAndAddChildren();

			SliceSettingsWidget.SettingChanged.RegisterEvent(CheckSettingChanged, ref unregisterEvents);
			ApplicationController.Instance.AdvancedControlsPanelReloading.RegisterEvent((s, e) => ClearGCode(), ref unregisterEvents);

			ActiveSliceSettings.ActivePrinterChanged.RegisterEvent(CheckSettingChanged, ref unregisterEvents);
		}
开发者ID:tellingmachine,项目名称:MatterControl,代码行数:24,代码来源:ViewGcodeBasic.cs


示例18: CvWindow

        /// <summary>
        /// ウィンドウ名と画像の表示モードと始めから表示しておく画像を指定して初期化
        /// </summary>
        /// <param name="name">ウィンドウの識別に用いられるウィンドウ名で,ウィンドウのタイトルバ ーに表示される.</param>
        /// <param name="flags">ウィンドウのフラグ</param>
        /// <param name="image">ウィンドウに表示する画像</param>
#else
        /// <summary>
        /// Creates a window
        /// </summary>
        /// <param name="name">Name of the window which is used as window identifier and appears in the window caption. </param>
        /// <param name="flags">Flags of the window. Currently the only supported flag is WindowMode.AutoSize. 
        /// If it is set, window size is automatically adjusted to fit the displayed image (see cvShowImage), while user can not change the window size manually. </param>
        /// <param name="image">Image to be shown.</param>
#endif
        public CvWindow(string name, WindowMode flags, CvArr image)
        {
            if (name == null)
            {
                throw new ArgumentNullException();
            }
            this.name = name;
            int status = NativeMethods.cvNamedWindow(name, flags);
            if (status == 0)
            {
                throw new OpenCvSharpException("Failed to create CvWindow");
            }
            this.image = image;
            ShowImage(image);
            trackbars = new Dictionary<string, CvTrackbar>();
            if (!Windows.ContainsKey(name))
            {
                Windows.Add(name, this);
            }
            callbackHandle = null;
        }
开发者ID:kaorun55,项目名称:opencvsharp,代码行数:36,代码来源:CvWindow.cs


示例19: ShowWindow

 public void ShowWindow(Character pc, WindowMode mode = WindowMode.DISPLAY, int slotID = 0, DetailsWindow child = null)
 {
     _pc = pc;
     cursorPos = 0;
     _windowmode = mode;
     _slotID = slotID;
     _child = child;
     pack = _pc.Backpack.Items;
     if (mode == WindowMode.DISPLAY)
     {
         _title = Game.Lang[StringName.BACKPACK_WND_TITLE];
     }
     else if (mode == WindowMode.DROP)
     {
         _title = Game.Lang[StringName.BACKPACK_WND_TITLE_DROP];
     }
     else
     {
         _title = Game.Lang[StringName.BACKPACK_WND_TITLE_EQUIP];
         SlotType st = EquipmentSlot.GetSlotType(_slotID);
         pack = _pc.Backpack.GetItemsBySlot(st);
     }
     base.drawWindow();
     drawText();
     windowLoop();
 }
开发者ID:Gnusznak,项目名称:CrystalsOfTime,代码行数:26,代码来源:BackpackWindow.cs


示例20: ViewGcodeBasic

		public ViewGcodeBasic(PrintItemWrapper printItem, Vector3 viewerVolume, Vector2 bedCenter, MeshViewerWidget.BedShape bedShape, WindowMode windowMode)
		{
			this.viewerVolume = viewerVolume;
			this.bedShape = bedShape;
			this.bedCenter = bedCenter;
			this.windowMode = windowMode;
			this.printItem = printItem;

			if (ActiveTheme.Instance.DisplayMode == ActiveTheme.ApplicationDisplayType.Touchscreen)
			{
				sliderWidth = 20;
			}
			else
			{
				sliderWidth = 10;
			}

			CreateAndAddChildren();

			SliceSettingsWidget.RegisterForSettingsChange("bed_size", RecreateBedAndPartPosition, ref unregisterEvents);
			SliceSettingsWidget.RegisterForSettingsChange("print_center", RecreateBedAndPartPosition, ref unregisterEvents);
			SliceSettingsWidget.RegisterForSettingsChange("build_height", RecreateBedAndPartPosition, ref unregisterEvents);
			SliceSettingsWidget.RegisterForSettingsChange("bed_shape", RecreateBedAndPartPosition, ref unregisterEvents);
			SliceSettingsWidget.RegisterForSettingsChange("center_part_on_bed", RecreateBedAndPartPosition, ref unregisterEvents);

			SliceSettingsWidget.RegisterForSettingsChange("extruder_offset", Clear3DGCode, ref unregisterEvents);
			ApplicationController.Instance.ReloadAdvancedControlsPanelTrigger.RegisterEvent(RecreateBedAndPartPosition, ref unregisterEvents);

			ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(RecreateBedAndPartPosition, ref unregisterEvents);
		}
开发者ID:glocklueng,项目名称:MatterControl,代码行数:30,代码来源:ViewGcodeBasic.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# WindowState类代码示例发布时间:2022-05-24
下一篇:
C# WindowMessage类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap