Esempio n. 1
0
        // POINT OF INTEREST
        // We override this to be able to wait for the physics simulator to finish a frame
        public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            // POINT OF INTEREST
            // Wait for the physics thread to finish the physics frame. Without this
            // this thread and the physics thread can read and modify the simulator
            // at the same time. That can cause incorrect updates and even crashes.
            if (_physicsProcessor != null)
            {
                _physicsProcessor.BlockUntilIdle();
            }

            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
        }