int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MSG msg; // Windows Message Structure
bool done = false; // Bool Variable To Exit Loop
// Ask The User Which Screen Mode They Prefer
// if (MessageBox(NULL, "Would You Like To Run In Fullscreen Mode?", "Start FullScreen?", MB_YESNO | MB_ICONQUESTION) == IDNO)
// {
// fullscreen = false; // Windowed Mode
// }
// Create Our OpenGL Window
if (!CreateGLWindow("CoverFlow Clone", resolution.width, resolution.height, 16, fullscreen))
return 0; // Quit If Window Was Not Created
while(!done) // Loop That Runs While done=false
{
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) // Is There A Message Waiting?
{
if (msg.message == WM_QUIT) // Have We Received A Quit Message?
done = true; // If So done = true
else // If Not, Deal With Window Messages
{
TranslateMessage(&msg); // Translate The Message
DispatchMessage(&msg); // Dispatch The Message
}
} else // If There Are No Messages
{
// Draw The Scene. Watch For ESC Key And Quit Messages From DrawGLScene()
if (keys[VK_ESCAPE]) // Was ESC Pressed?
done = true; // ESC Signalled A Quit
else // Not Time To Quit, Update Screen
{
HotKeyProcess();
// now = getTime();
DrawGLScene(); // Draw The Scene
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
}
}
}
// Shutdown
KillGLWindow(); // Kill The Window
return (int)(msg.wParam); // Exit The Program
}