當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。