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


C# GraphicsDeviceManager.ApplyChanges方法代码示例

本文整理汇总了C#中Microsoft.Xna.Framework.GraphicsDeviceManager.ApplyChanges方法的典型用法代码示例。如果您正苦于以下问题:C# GraphicsDeviceManager.ApplyChanges方法的具体用法?C# GraphicsDeviceManager.ApplyChanges怎么用?C# GraphicsDeviceManager.ApplyChanges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Xna.Framework.GraphicsDeviceManager的用法示例。


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

示例1: Configuration

        public Configuration(Game game)
            : base(game)
        {
            graphics = new GraphicsDeviceManager(game);
            Game_Library.Configuration config = game.Content.Load<Game_Library.Configuration>("Interface/Configuration");
            Width = config.Width;
            Height = config.Height;
            Fullscreen = config.Fullscreen;

            if (Fullscreen == true)
            {
                graphics.PreferredBackBufferWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
                graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
                graphics.ApplyChanges();
                if (graphics.IsFullScreen == false)
                    graphics.ToggleFullScreen();
            }
            else
            {
                graphics.PreferredBackBufferHeight = Height;
                graphics.PreferredBackBufferWidth = Width;
                graphics.ApplyChanges();
                if (graphics.IsFullScreen == true)
                    graphics.ToggleFullScreen();
            }
            game.Window.ClientSizeChanged += new EventHandler<EventArgs>(OnResize);
        }
开发者ID:hkeeble,项目名称:GroupProject,代码行数:27,代码来源:Configuration.cs

示例2: Main

        public Main()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            graphics.PreferredBackBufferWidth = Window.ClientBounds.Width;
            graphics.PreferredBackBufferHeight = Window.ClientBounds.Height;
            graphics.PreferMultiSampling = true;
            graphics.ApplyChanges();

            Window.AllowUserResizing = true;
            Window.ClientSizeChanged += (object sender, EventArgs e) => {
                if (player != null && player.Camera != null)
                    player.Camera.AspectRatio = (float)Window.ClientBounds.Width / Window.ClientBounds.Height;

                graphics.PreferredBackBufferWidth = Window.ClientBounds.Width;
                graphics.PreferredBackBufferHeight = Window.ClientBounds.Height;
                graphics.ApplyChanges();

                if (world != null) {
                    world.sunRenderTarget = new RenderTarget2D(GraphicsDevice, Window.ClientBounds.Width, Window.ClientBounds.Height, false, GraphicsDevice.PresentationParameters.BackBufferFormat, GraphicsDevice.PresentationParameters.DepthStencilFormat);
                    world.postfxRenderTarget1 = new RenderTarget2D(GraphicsDevice, Window.ClientBounds.Width, Window.ClientBounds.Height, false, GraphicsDevice.PresentationParameters.BackBufferFormat, GraphicsDevice.PresentationParameters.DepthStencilFormat);
                    world.postfxRenderTarget2 = new RenderTarget2D(GraphicsDevice, Window.ClientBounds.Width, Window.ClientBounds.Height, false, GraphicsDevice.PresentationParameters.BackBufferFormat, GraphicsDevice.PresentationParameters.DepthStencilFormat);
                    world.sceneRenderTarget = new RenderTarget2D(GraphicsDevice, Window.ClientBounds.Width, Window.ClientBounds.Height, false, GraphicsDevice.PresentationParameters.BackBufferFormat, GraphicsDevice.PresentationParameters.DepthStencilFormat);
                }
            };

            ((System.Windows.Forms.Form)System.Windows.Forms.Form.FromChildHandle(Window.Handle)).WindowState = System.Windows.Forms.FormWindowState.Maximized;
        }
开发者ID:Shmaug,项目名称:Voxel-Generator,代码行数:29,代码来源:Main.cs

示例3: App1

 /// <summary>
 /// Default constructor.
 /// </summary>
 public App1()
 {
     graphics = new GraphicsDeviceManager(this);
     graphics.PreferMultiSampling = true;
     graphics.ApplyChanges();
     Content.RootDirectory = "Content";
 }
开发者ID:Ryuzaki,项目名称:RVTN,代码行数:10,代码来源:App1.cs

示例4: Game1

        public Game1()
        {
            Content.RootDirectory = "Content";
            graphics = new GraphicsDeviceManager(this);

            //uncommenting this would change the default fram rate cycles to 50fps
            //this.TargetElapsedTime = TimeSpan.FromSeconds(1.0f / 50f);

            #if WINDOWS_PHONE
            graphics.PreferredBackBufferWidth = 800;
            graphics.PreferredBackBufferHeight = 480;
            #endif

            #if XBOX || WINDOWS
            graphics.PreferredBackBufferWidth = 1280;
            graphics.PreferredBackBufferHeight = 720;
            #endif
            graphics.PreferMultiSampling = true;
            parameters.MultiSampleCount = 16;
            graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings);
            graphics.ApplyChanges();

            Camera.ViewportWidth = graphics.PreferredBackBufferWidth;
            Camera.ViewportHeight = graphics.PreferredBackBufferHeight;
            Camera.SetScreenRectangle();

            screenManager = new ScreenManager(this);
            Components.Add(screenManager);
        }
开发者ID:markadamdixon,项目名称:CinematicCreditRoll_Csharp,代码行数:29,代码来源:Game1.cs

示例5: TrueCraftGame

        public TrueCraftGame(MultiplayerClient client, IPEndPoint endPoint)
        {
            Window.Title = "TrueCraft";
            Content.RootDirectory = "Content";
            Graphics = new GraphicsDeviceManager(this);
            Graphics.SynchronizeWithVerticalRetrace = false;
            Graphics.IsFullScreen = UserSettings.Local.IsFullscreen;
            Graphics.PreferredBackBufferWidth = UserSettings.Local.WindowResolution.Width;
            Graphics.PreferredBackBufferHeight = UserSettings.Local.WindowResolution.Height;
            Graphics.ApplyChanges();
            Window.ClientSizeChanged += Window_ClientSizeChanged;
            Client = client;
            EndPoint = endPoint;
            LastPhysicsUpdate = DateTime.MinValue;
            NextPhysicsUpdate = DateTime.MinValue;
            PendingMainThreadActions = new ConcurrentBag<Action>();
            MouseCaptured = true;
            Bobbing = 0;

            KeyboardComponent = new KeyboardHandler(this);
            Components.Add(KeyboardComponent);

            MouseComponent = new MouseHandler(this);
            Components.Add(MouseComponent);

            GamePadComponent = new GamePadHandler(this);
            Components.Add(GamePadComponent);
        }
开发者ID:Khazarak,项目名称:TrueCraft,代码行数:28,代码来源:TrueCraftGame.cs

示例6: DnK

        public DnK()
        {
            Graphics = new GraphicsDeviceManager(this)
            {
                PreferredBackBufferWidth = Config.Resolution.X,
                PreferredBackBufferHeight = Config.Resolution.Y
            };

            ScreenRectangle = new Rectangle(0, 0, Config.Resolution.X, Config.Resolution.Y);
            IsMouseVisible = true;
            Graphics.IsFullScreen = Config.FullScreen;
            Graphics.SynchronizeWithVerticalRetrace = true;

            // Pass through the FPS capping (60 FPS)
            if (!Config.FpsCapping)
            {
                IsFixedTimeStep = false;
                Graphics.SynchronizeWithVerticalRetrace = false;
            }

            Graphics.ApplyChanges();

            Content.RootDirectory = "Content";

            Pixel = new Texture2D(GraphicsDevice, 1, 1);
            Pixel.SetData(new [] { Color.White });
        }
开发者ID:Noxalus,项目名称:Danmaku-no-Kyojin,代码行数:27,代码来源:DnK.cs

示例7: Game1

        public Game1()
        {
            if (!File.Exists(Path.Combine(_userConfigPath, "config.us")))
            {
                CreateUserConfig();
            }

            var config = XDocument.Load(Path.Combine(_userConfigPath, "config.us"));
            var username = config.Root.Element("Username");
            Global.PlayerName = username.Value;

            Graphics = new GraphicsDeviceManager(this)
            {
                PreferredBackBufferHeight = GraphicsDevice.DisplayMode.Height,
                PreferredBackBufferWidth = GraphicsDevice.DisplayMode.Width,
                IsFullScreen = Global.IsFullScreen
            };

            Graphics.ApplyChanges();
            Global.DeviceInUse = Graphics;
            Content.RootDirectory = "Content";
            Global.GameInProgress = this;
            var screenManager = new ScreenManager.ScreenManager(this);

            Components.Add(screenManager);
            MediaPlayer.IsMuted = true;

            // Activate the first screens.
            screenManager.AddScreen(new BackgroundScreen(), null);
            screenManager.AddScreen(new IntroScreen(), null);
        }
开发者ID:umutseven92,项目名称:Romero.Windows,代码行数:31,代码来源:Game1.cs

示例8: TankAGame

        public TankAGame()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth = 1000;
            graphics.PreferredBackBufferHeight = 750;
            graphics.ApplyChanges();

            this.IsFixedTimeStep = false;
            random = new Random();

            Content.RootDirectory = "Content";

            config = TankAConfig.Instance;
            config.LoadFromConfigFile();

            screenManager = new ScreenManager(this);
            Components.Add(screenManager);

            // Active first screen
            screenManager.AddScreen(new BackgroundScreen(), null);
            screenManager.AddScreen(new MainMenuScreen(), null);

            network = new NetworkManager(this);
            Components.Add(network);
            Services.AddService(typeof(INetworkManager), network);
            thisGame = this;
        }
开发者ID:sinhpham,项目名称:tanka,代码行数:27,代码来源:TankAGame.cs

示例9: ExampleGame

 public ExampleGame()
 {
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
     graphics.IsFullScreen = true;
     graphics.ApplyChanges();
 }
开发者ID:jpgdev,项目名称:JPEngine,代码行数:7,代码来源:ExampleGame.cs

示例10: MadLabGame

        /// <summary>
        /// The main game constructor
        /// </summary>
        public MadLabGame()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            this.TargetElapsedTime = TimeSpan.FromSeconds(1.0f / 60f);

            // Setup window
            Window.Title = "MadLab";
            graphics.PreferredBackBufferWidth = GameConstants.X_RESOLUTION;
            graphics.PreferredBackBufferHeight = GameConstants.Y_RESOLUTION;
            graphics.IsFullScreen = false;
            graphics.ApplyChanges();

            // Create the screen factory and add it to the Services
            screenFactory = new ScreenFactory();
            Services.AddService(typeof(IScreenFactory), screenFactory);

            // Create the screen manager component.
            screenManager = new ScreenManager(this);

            // component for screenManager
            Components.Add(screenManager);

            # if(XBOX)
            Components.Add(new GamerServicesComponent(this));
            #endif
        }
开发者ID:matthewlouis,项目名称:MadScienceLab,代码行数:30,代码来源:MadLabGame.cs

示例11: PokeGame

        public PokeGame()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.ApplyChanges();

            Content.RootDirectory = "Content";
        }
开发者ID:heyitsanewb,项目名称:PokeWorld-Online,代码行数:7,代码来源:PokeGame.cs

示例12: Game

        /// <summary>
        /// Game Constructor-
        /// set the game constants
        /// NOTE: at some point the constants should probably be read from a configuration file
        /// </summary>
        public Game()
        {
            // Load the game settings
            GameConfig = new Config(@"Configs\GameSettings.ini");

            // Set up logging
            if (GameConfig.GetBoolValue("DebugLogging", false))
            {
                string logPath = GameConfig.GetStringValue("DebugLoggingPath", null);
                int logsToKeep = GameConfig.GetIntValue("DebugLoggingToKeep", 3);
                if (logPath != null)
                {
                    Logger.Initialize(logPath, logsToKeep);
                }
            }

            // Set up the graphics device
            Graphics = new GraphicsDeviceManager(this);
            Graphics.PreferredBackBufferWidth = Constants.WINDOW_WIDTH;
            Graphics.PreferredBackBufferHeight = Constants.WINDOW_HEIGHT;
            Graphics.IsFullScreen = GameConfig.GetBoolValue("FullScreen", false);
            Graphics.ApplyChanges();

            Content.RootDirectory = "Content";

            // Window Properties
            this.IsMouseVisible = true;
            this.Window.Title = "University Simulator 2014";
            this.Window.AllowUserResizing = false;
        }
开发者ID:GoodSky,项目名称:Sim-U,代码行数:35,代码来源:Game.cs

示例13: Game1

        public Game1()
        {
            Content.RootDirectory = "Content";
            graphics = new GraphicsDeviceManager(this);
            //this.TargetElapsedTime = TimeSpan.FromSeconds(1.0f / 54f);
            #if WINDOWS_PHONE
            graphics.PreferredBackBufferWidth = 800;
            graphics.PreferredBackBufferHeight = 480;
            #endif

            #if XBOX || WINDOWS
            graphics.PreferredBackBufferWidth = 1280;
            graphics.PreferredBackBufferHeight = 720;
            #endif
            graphics.PreferMultiSampling = true;
            parameters.MultiSampleCount = 16;
            graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings);
            graphics.ApplyChanges();

            // Create the screen manager component.
            screenManager = new ScreenManager(this);

            Camera.ViewportWidth = graphics.PreferredBackBufferWidth;
            Camera.ViewportHeight = graphics.PreferredBackBufferHeight;
            Camera.SetScreenRectangle();

            Components.Add(screenManager);

            // Activate the first screens.
            screenManager.AddScreen(new BackgroundScreen(), null);
            screenManager.AddScreen(new PressStartScreen(), null);

            //Guide.SimulateTrialMode = false;
        }
开发者ID:markadamdixon,项目名称:CompletedGame_ProduceWars_CSharp,代码行数:34,代码来源:Game1.cs

示例14: Game1

        //private double score = 0;

        public Game1() {
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth = 1600;  // set this value to the desired width of your window
            graphics.PreferredBackBufferHeight = 900;   // set this value to the desired height of your window
            graphics.ApplyChanges();
            Content.RootDirectory = "Content";
        }
开发者ID:J-O-K-E-R,项目名称:3951,代码行数:9,代码来源:Game1.cs

示例15: Game1

        public Game1(string[] args)
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            graphics.PreferredBackBufferWidth = 1366;
            graphics.PreferredBackBufferHeight = 768;

            graphics.PreferMultiSampling = true;
            this.Window.Title = Title;
            this.Window.AllowUserResizing = true;
            this.IsMouseVisible = false;

            graphics.ApplyChanges();

            dflip.SystemParameter.clientBounds = new BoundingBox2D(new Vector2(Window.ClientBounds.Left, Window.ClientBounds.Top), new Vector2(Window.ClientBounds.Right, Window.ClientBounds.Bottom), 0f);
            dflip.SystemParameter.ClientHeight = (int)this.Window.ClientBounds.Height;
            dflip.SystemParameter.ClientWidth = (int)this.Window.ClientBounds.Width;
            dflip.SystemParameter.control = System.Windows.Forms.Control.FromHandle(this.Window.Handle);

            this.Window.ClientSizeChanged += new EventHandler<EventArgs>(Window_ClientSizeChanged);

            mainProcess = new dflip.SystemParameter();
            if (args.Length > 0)
            {
                profilePath = args[0];
            }
            else profilePath = "profile.ini";
        }
开发者ID:icd-lab,项目名称:d-flip-series,代码行数:28,代码来源:Game1.cs


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