Exemplo n.º 1
0
 public void Dispose()
 {
     // POINT OF INTEREST
     // Signal the phyisics thread to exit, reset the iteration params and signal the
     // physics thread so it will exit
     _doExit       = true;
     _iterateParam = new IterateParam(new GameTime());
     _processEvent.Set();
 }
Exemplo n.º 2
0
        // POINT OF INTEREST
        // This is to signal the physics thread to update the simulator. Iterate is
        // going to be called on the main thread. This is not going to update the
        // simulator, just send the signal to the other thread to get the job done.
        public void Iterate(GameTime gameTime, bool forceSingleThreaded)
        {
            // POINT OF INTEREST
            // If the simulation can not be syncronied we force the PhysicsProcessor to do the
            // physics update on this thread /the main thread/.
            _forceSingleThreaded = forceSingleThreaded;
            // POINT OF INTEREST
            // Fill the iterate params with all the needed info and signal the physics thread
            // to iterate the simulator
            _iterateParam = new IterateParam(gameTime);
            _processEvent.Set();

            // POINT OF INTEREST
            // If there is no multithreading enabled /only one HW threads/, or the application
            // disabled it manually /DebugView/, do the update on this thread.
            if (!_useMultiThreading || forceSingleThreaded)
            {
                DoThinkPhysics();
            }
        }