Пример #1
0
        private void RenderThreadStart(object param)
        {
            // TODO: OP! Initialize render log file

            ProfilerShort.Autocommit = false;

            var startParams = (StartParams)param;

            m_renderWindow = startParams.InitHandler();
            var control = System.Windows.Forms.Control.FromHandle(m_renderWindow.Handle);

            m_settings = MyRenderProxy.CreateDevice(this, m_renderWindow.Handle, startParams.SettingsToTry);
            MyRenderProxy.SendCreatedDeviceSettings(m_settings);
            m_currentQuality = startParams.RenderQuality;
            m_form           = control;

            LoadContent();
            UpdateSize();

            //RenderLoop.UseCustomDoEvents = true;
            RenderLoop.Run(m_form, RenderCallback);

            UnloadContent();

            MyRenderProxy.DisposeDevice();
        }
Пример #2
0
        /// <summary>
        /// Signals the thread to exit and waits until it does so
        /// </summary>
        public void Exit()
        {
            Debug.Assert(!m_stopped, "Already stopped");
            m_stopped = true;

            if (SystemThread != null)
            {
                // TODO: OP! Should be done better
                try
                {
                    if (!m_form.IsDisposed)
                    {
                        m_form.Invoke(new Action(OnExit));
                    }
                }
                catch
                {
                    // Racing condition, form can be disposed after check and before Invoke
                }

                // TODO: OP! Should be done better
                if (Thread.CurrentThread != SystemThread)
                {
                    SystemThread.Join();
                }
            }
            else
            {
                UnloadContent();
                MyRenderProxy.DisposeDevice();
            }
        }
Пример #3
0
        public void Dispose()
        {
            if (RenderThread != null)
            {
                Stop();
            }

            MyRenderProxy.DisposeDevice();
        }
Пример #4
0
        private void RenderThreadStart(object param)
        {
            // TODO: OP! Initialize render log file

            ProfilerShort.Autocommit = false;

            var startParams = (StartParams)param;

            m_renderWindow = startParams.InitHandler();
#if !XB1
            var control = System.Windows.Forms.Control.FromHandle(m_renderWindow.Handle);
#endif

            m_settings = MyRenderProxy.CreateDevice(this, m_renderWindow.Handle, startParams.SettingsToTry);
            if (m_settings.AdapterOrdinal == -1)
            {
                return;
            }
            MyRenderProxy.SendCreatedDeviceSettings(m_settings);
            m_currentQuality = startParams.RenderQuality;
#if !XB1
            m_form = control;
#else
            m_form = m_renderWindow as RenderForm;
#endif

            LoadContent();
            UpdateSize();

            //RenderLoop.UseCustomDoEvents = true;
            //RenderLoop.Run(m_form, RenderCallback);

            m_form.Show();
            while (m_form.Visible)
            {
                Application.DoEvents();
                if (m_form.Visible)
                {
                    RenderCallback();
                }
            }

            UnloadContent();

            MyRenderProxy.DisposeDevice();
        }
Пример #5
0
        /// <summary>
        /// Signals the thread to exit and waits until it does so
        /// </summary>
        public void Exit()
        {
            if (Interlocked.Exchange(ref m_stopped, 1) == 1)
            {
                return;
            }

            if (SystemThread != null)
            {
                // TODO: OP! Should be done better
                try
                {
#if !XB1
                    if (!m_form.IsDisposed)
                    {
                        m_form.Invoke(new Action(OnExit));
                    }
#endif
                }
                catch
                {
                    // Racing condition, form can be disposed after check and before Invoke
                }

                // TODO: OP! Should be done better
                if (Thread.CurrentThread != SystemThread)
                {
                    SystemThread.Join();
                }
            }
            else
            {
                UnloadContent();
                MyRenderProxy.DisposeDevice();
            }
        }