we're working on an official mechanism in #1599 in response to your feedback (thank you!), but you c

we're working on an official mechanism in #1599 in response to your feedback (thank you!), but you could try:
const double loopsPerSecond = 10000;

Stopwatch loopStopwatch = Stopwatch.StartNew();
window.Initialize();
while (!window.IsClosing)
{
    do
    {
        if (X86Base.IsSupported)
        {
            X86Base.Pause();
        }
    }
    while (loopStopwatch.Elapsed.TotalSeconds < (1 / loopsPerSecond));
    window.DoEvents();
    if (!window.IsClosing)
    {
        window.DoUpdate();
    }
    if (!window.IsClosing)
    {
        window.DoRender();
    }
}
window.DoEvents();
window.Reset();
Was this page helpful?