仅游戏循环就使用了 50% 的 CPU 使用率,我还没有做任何渲染工作。我在这里做什么?
while(true)
{
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if(msg.message == WM_QUIT ||
msg.message == WM_CLOSE ||
msg.message == WM_DESTROY)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
//Run game code, break out of loop when the game is over
}
}