Exemple #1
0
        public void Update(Action frameAction)
        {
            var now   = Winmm.timeGetTime();
            var delta = (int)(now - m_last);

            if (delta > m_msInFrame)
            {
                frameAction();
                m_last = now;
            }
            else
            {
                Thread.Sleep(m_msInFrame - delta);
            }
        }
Exemple #2
0
 public FPSTimer(int fps)
 {
     m_last      = Winmm.timeGetTime();
     m_msInFrame = 1000 / fps - 5;
 }