fuzzybinary / AngelXNA

AngelXNA is a port of the Angel C++ game prototyping engine to Microsoft's XNA platform. It offers simple structures for prototyping game ideas for any platform XNA supports.

Clone this repository (size: 4.7 MB): HTTPS / SSH
$ hg clone http://bitbucket.org/fuzzybinary/angelxna/
commit 83: ef3162577ee0
parent 82: 06c9ab318519
parent 81: ef34de3c810a
branch: default
merge
jeffw
3 months ago

Changed (Δ271 bytes):

raw changeset »

AngelXNA/Infrastructure/World.cs (22 lines added, 16 lines removed)

Up to file-list AngelXNA/Infrastructure/World.cs:

@@ -153,7 +153,11 @@ namespace AngelXNA.Infrastructure
153
153
            if (_bThreadedPhysics)
154
154
            {
155
155
                _physicsThread = new Thread(new ThreadStart(
156
                    delegate() {
156
                    delegate()
157
                    {
158
#if XBOX
159
                        Thread.CurrentThread.SetProcessorAffinity(4);
160
#endif
157
161
                        while (_bThreadedPhysics)
158
162
                        {
159
163
                            _runPhysics.WaitOne();
@@ -165,9 +169,6 @@ namespace AngelXNA.Infrastructure
165
169
                        }
166
170
                    }
167
171
                ));
168
#if XBOX
169
                _physicsThread.SetProcessorAffinity(4);
170
#endif
171
172
                _physicsThread.Start();
172
173
            }
173
174
@@ -210,6 +211,8 @@ namespace AngelXNA.Infrastructure
210
211
                    list.AddLast(newElement);
211
212
                    _layers.Add(layer, list);
212
213
                }
214
215
                newElement.AddedToWorld();
213
216
            }
214
217
            // If we're locked, add to _deferredAdds and we'll add the new
215
218
            // Renderable after we're done updating all the _elements.
@@ -296,6 +299,12 @@ namespace AngelXNA.Infrastructure
296
299
297
300
        public void Simulate(GameTime aGameTime)
298
301
        {
302
            if (_bThreadedPhysics)
303
            {
304
                _waitPhysics.WaitOne();
305
                SyncPhyiscs();
306
            }
307
299
308
            // system updates
300
309
            DeveloperConsole.Instance.Update( aGameTime );
301
310
            // theControllerManager.UpdateState();
@@ -308,18 +317,20 @@ namespace AngelXNA.Infrastructure
308
317
                // Deliver any messages that have been queued from the last frame. 
309
318
                Switchboard.Instance.SendAllMessages();
310
319
311
                if (_bThreadedPhysics)
312
                {
313
                    _waitPhysics.WaitOne();
314
                    SyncPhyiscs();
315
                }
316
317
320
                //Clear out the collision contact points
318
321
                _collisionManager.Clear();
319
322
320
323
                //rb - Flag that the _elements array is locked so we don't try to add any
321
324
                // new actors during the update.
322
325
                _elementsLocked = true;
326
                    // this means phisics updates can't remove themselves from
327
                    // the world or spawn new physics objects. This is a huge assumption
328
                    if (_bThreadedPhysics)
329
                    {
330
                        _lastDt = (float)aGameTime.ElapsedGameTime.TotalSeconds;
331
                        _runPhysics.Set();
332
                    }
333
323
334
                    UpdateRenderables(aGameTime);
324
335
                    CleanupRenderables();
325
336
                _elementsLocked = false;
@@ -329,12 +340,7 @@ namespace AngelXNA.Infrastructure
329
340
                ProcessDeferredLayerChanges();
330
341
                ProcessDeferredRemoves();
331
342
332
                if (_bThreadedPhysics)
333
                {
334
                    _lastDt = (float)aGameTime.ElapsedGameTime.TotalSeconds;
335
                    _runPhysics.Set();
336
                }
337
                else
343
                if(!_bThreadedPhysics)
338
344
                {
339
345
                    RunPhysics((float)aGameTime.ElapsedGameTime.TotalSeconds);
340
346
                    SyncPhyiscs();