Exemplo n.º 1
0
        public MultithreadedGame()
            : base() {

            _DrawThread = new WorkerThread(ThreadedDraw, 3);

#if XBOX
            Thread.CurrentThread.SetProcessorAffinity(1);
#endif
        }
Exemplo n.º 2
0
        protected void ThreadedDraw(WorkerThread thread) {
            try {
                RenderFrameToDraw();

                base.EndDraw();

                _DeviceLost |= CheckGraphicsDeviceLost();
            } catch (DeviceLostException) {
                _DeviceLost = true;
            } finally {
                Interlocked.Decrement(ref _DrawDepth);
            }
        }
Exemplo n.º 3
0
        protected void ThreadedDraw(WorkerThread thread)
        {
            try {
                RenderFrameToDraw();

                _SyncEndDraw();

                _DeviceLost |= IsDeviceLost;
            } catch (DeviceLostException) {
                _DeviceLost = true;
            } catch (ObjectDisposedException) {
                if (Device.IsDisposed)
                    _Running = false;
                else
                    throw;
            } finally {
                Interlocked.Decrement(ref _DrawDepth);
            }
        }
Exemplo n.º 4
0
        private void CoreInitialize()
        {
            _DrawThread = new WorkerThread(ThreadedDraw);

            Device.DeviceResetting += OnDeviceResetting;
            Device.DeviceReset += OnDeviceReset;
        }
Exemplo n.º 5
0
        public void Dispose()
        {
            _Running = false;

            try {
                if (_DrawThread != null) {
                    _DrawThread.Dispose();
                    _DrawThread = null;
                }

                FlushPendingDisposes();
            } catch (ObjectDisposedException) {
            } catch (DeviceLostException) {
            } catch (DeviceNotResetException) {
            }
        }