예제 #1
0
        // display the FPS using a LabelAtlas
        // updates the FPS every frame
        private void ShowStats()
        {
            if (m_bDisplayStats)
            {
                if (m_pFPSLabel != null && m_pUpdateTimeLabel != null && m_pDrawsLabel != null)
                {
                    if (m_fAccumDt > CCMacros.CCDirectorStatsUpdateIntervalInSeconds)
                    {
                        m_pFPSLabel.Text = (String.Format("{0:00.0}", m_uDrawCount / m_fAccumDt));

                        m_pUpdateTimeLabel.Text = (String.Format("{0:0.000}", m_fAccumUpdate / m_uUpdateCount));
                        m_pDrawTimeLabel.Text   = (String.Format("{0:0.000}", m_fAccumDraw / m_uDrawCount));
                        m_pDrawsLabel.Text      = (String.Format("{0:000}", CCDrawManager.DrawCount));

                        m_fAccumDt   = m_fAccumDraw = m_fAccumUpdate = 0;
                        m_uDrawCount = m_uUpdateCount = 0;
                    }

                    m_pDrawsLabel.Visit();
                    m_pFPSLabel.Visit();
                    m_pUpdateTimeLabel.Visit();
                    m_pDrawTimeLabel.Visit();
                }
            }
        }
예제 #2
0
        // display the FPS using a LabelAtlas
        // updates the FPS every frame
        private void ShowStats()
        {
            if (m_bDisplayStats)
            {
                if (!_wk.IsAlive)
                {
                    _GCCount++;
                    _wk = new WeakReference(new object());
                }

                if (m_pFPSLabel == null)
                {
                    CreateStatsLabel();
                }

                if (m_pFPSLabel != null && m_pUpdateTimeLabel != null && m_pDrawsLabel != null)
                {
                    if (m_fAccumDt > CCMacros.CCDirectorStatsUpdateIntervalInSeconds)
                    {
                        m_pFPSLabel.Text = (String.Format("{0:00.0}", m_uDrawCount / m_fAccumDt));

                        m_pUpdateTimeLabel.Text = (String.Format("{0:0.000}", m_fAccumUpdate / m_uUpdateCount));
                        m_pDrawTimeLabel.Text   = (String.Format("{0:0.000}", m_fAccumDraw / m_uDrawCount));
                        m_pDrawsLabel.Text      = (String.Format("{0:000}", CCDrawManager.DrawCount));

                        m_fAccumDt   = m_fAccumDraw = m_fAccumUpdate = 0;
                        m_uDrawCount = m_uUpdateCount = 0;

                        m_pMemoryLabel.Text = String.Format("{0}", GC.GetTotalMemory(false) / 1024);
                        m_pGCLabel.Text     = String.Format("{0}", _GCCount);
                    }

                    m_pDrawsLabel.Visit();
                    m_pFPSLabel.Visit();
                    m_pUpdateTimeLabel.Visit();
                    m_pDrawTimeLabel.Visit();
                    m_pMemoryLabel.Visit();
                    m_pGCLabel.Visit();
                }
            }
        }