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); } }
public FPSTimer(int fps) { m_last = Winmm.timeGetTime(); m_msInFrame = 1000 / fps - 5; }