int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int nCmdShow)			
{									
    MSG         msg;	

	game = new Game(&backHDC, &frontHDC, &bitmapHDC, &screenRect, &CONTROLS);
	RegisterMyWindow(hInstance);

   	if (!InitialiseMyWindow(hInstance, nCmdShow))
	return FALSE;
	
	setBuffers();
	while (TRUE)					
    {							
		if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
		{
		    if (msg.message==WM_QUIT)
				break;
			TranslateMessage (&msg);							
			DispatchMessage (&msg);
		}

		else
		{	
			if(WaitFor(10))
				game->play();
		}
    }

    releaseResources();
	return msg.wParam ;										
}
Example #2
0
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int nCmdShow)			
{									
    MSG       msg;	
	HDC	hdcWindow;

	RegisterMyWindow(hInstance);

   	if (!InitialiseMyWindow(hInstance, nCmdShow))
		return FALSE;

	hdcWindow = GetWindowDC (Application.ghwnd);
	Application.setBuffers();

	while (Application.Running())					
    {							
		if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
		{
		    if (msg.message==WM_QUIT)
				break;
			TranslateMessage (&msg);							
			DispatchMessage (&msg);
		}

		else
		{	
			Application.MainLoop();
		}
    }

    Application.releaseResources();
	return msg.wParam ;										
}
Example #3
0
// Entry point. The program start here
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int nCmdShow)
{
	MSG         msg;
	RegisterMyWindow(hInstance);

	if (!InitialiseMyWindow(hInstance, nCmdShow))
		return FALSE;

	scene.Init(&hwnd, &input);
	timer.Initialize();
	bool running = true;
	userContinue = true;

	while (running)
	{
		if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
		{
			if (msg.message == WM_QUIT)
				break;
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		} else
		{
			// update delta time
			timer.Frame();
			// Update and render scene
			scene.Update(timer.GetTime());
			userContinue = TestKeys();
		}

		if (!userContinue)
		{
			running = UserContinue();
		}
	}

	return msg.wParam;
}