Example #1
0
        public void Update(GameTime gameTime)
        {
            if (!m_bPaused)
            {
                if (m_bNextDeltaTimeZero)
                {
                    m_fDeltaTime         = 0;
                    m_bNextDeltaTimeZero = false;
                }
                else
                {
                    m_fDeltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;
                }

#if DEBUG
                if (m_fDeltaTime > 0.2f)
                {
                    m_fDeltaTime = 1 / 60.0f;
                }
#endif
                // In Seconds
                m_pScheduler.update(m_fDeltaTime);
            }

            /* to avoid flickr, nextScene MUST be here: after tick and before draw.
             * XXX: Which bug is this one. It seems that it can't be reproduced with v0.9 */
            if (m_pNextScene != null)
            {
                SetNextScene();
            }
        }
Example #2
0
        public void Update(GameTime gameTime)
        {
            float startTime = 0;

            if (m_bDisplayStats)
            {
                startTime = (float)m_pStopwatch.Elapsed.TotalMilliseconds;
            }

            if (!m_bPaused)
            {
                if (m_bNextDeltaTimeZero)
                {
                    m_fDeltaTime         = 0;
                    m_bNextDeltaTimeZero = false;
                }
                else
                {
                    m_fDeltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;
                }

                // In Seconds
                m_pScheduler.update(m_fDeltaTime);
            }

            /* to avoid flickr, nextScene MUST be here: after tick and before draw.
             * XXX: Which bug is this one. It seems that it can't be reproduced with v0.9 */
            if (m_pNextScene != null)
            {
                SetNextScene();
            }

            m_fAccumDt += m_fDeltaTime;

            if (m_bDisplayStats)
            {
                m_uUpdateCount++;
                m_fAccumUpdate += (float)m_pStopwatch.Elapsed.TotalMilliseconds - startTime;
            }
        }