Example #1
0
        protected override void Update(GameTime gameTime)
        {
            if (!IsActive)
            {
                return;
            }
            WindowBounds = Window.ClientBounds;

            _graphics.PreferredBackBufferWidth  = 800;
            _graphics.PreferredBackBufferHeight = 480;
            _graphics.ApplyChanges();

            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            Dimension.DestroyThings();
            Dimension.LoadThings();

            SoundManager.PopCoins();

            // step logic
            foreach (var obj in Dimension.Current.GameObjects)
            {
                var gameObject = obj;
                gameObject.step();
            }
            foreach (var chunk in Dimension.Current.Chunks)
            {
                if (chunk != null)
                {
                    Chunk.Step(chunk);
                }
            }
            base.Update(gameTime);
        }