1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
bool fDone;
HWND hWnd;
if (GenerateWindow(hInstance, nCmdShow, L"Direct3D", L"My prog", 9, 6, 1792, 128, hWnd))
{
MSG msg;
game = new Game();
if (game->Initialize(hWnd))
{
fDone = false;
while (!fDone)
{
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT)
{
fDone = true;
break;
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
game->Run();
std::this_thread::sleep_until(nextStartTime);
currentStartTime = std::chrono::system_clock::now();
nextStartTime = (currentStartTime + intervalPeriodMillis);
}
delete game;
}
}
return 0;
} |
Partager