當前位置: 首頁>>代碼示例>>C#>>正文


C# Camera2D.SetSceneBounds方法代碼示例

本文整理匯總了C#中Camera2D.SetSceneBounds方法的典型用法代碼示例。如果您正苦於以下問題:C# Camera2D.SetSceneBounds方法的具體用法?C# Camera2D.SetSceneBounds怎麽用?C# Camera2D.SetSceneBounds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Camera2D的用法示例。


在下文中一共展示了Camera2D.SetSceneBounds方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Initialize

        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            graphics.PreferredBackBufferWidth = graphics.GraphicsDevice.DisplayMode.Width;
            graphics.PreferredBackBufferHeight = graphics.GraphicsDevice.DisplayMode.Height;
            graphics.ApplyChanges();
            //Engine.LevelBounds = new Rectangle(0, 0, graphics.GraphicsDevice.Viewport.Width * 2, graphics.GraphicsDevice.Viewport.Height);

            base.Initialize();
            Engine.InitializeLevel("Level1");
            player = Engine.InitializePlayer();
            Engine.InitializeEnemies();
            Engine.InitializeObjects();
            Engine.InitializeUpdatableObjects();
            Engine.InitializeItems();
            camera = new Camera2D(graphics.GraphicsDevice);
            camera.SetSceneBounds(new Rectangle(50, 50, Engine.LevelBounds.Width - 200, Engine.LevelBounds.Height));
            camera.SetChaseTarget(player);
            debug = new MidoriDebug(Content, spriteBatch);

            gameOver = false;
            player.PlayerIsDead += (sender, evArgs) => { gameOver = true; };
        }
開發者ID:CharlieScarver,項目名稱:TeamMidori,代碼行數:28,代碼來源:Game1.cs


注:本文中的Camera2D.SetSceneBounds方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。