コード例 #1
0
ファイル: WinMain.cpp プロジェクト: justinvan0603/BattleCity
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
	LPTSTR lpCmdLine, int nCmdShow)
{
	Game game;
	if (!game.GameInit(hInstance))
		return false;
	MSG msg;
	ZeroMemory(&msg, sizeof(msg));
	while (msg.message != WM_QUIT)
	{
		// Kiểm tra các sự kiện được gửi tới trong hàng đợi của ứng dụng
		if (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
		else
		{
			// Game run
		}
	}
	return (int)msg.wParam;
}
コード例 #2
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                   LPTSTR lpCmdLine, int nCmdShow)
{
    ///this is a comment
    Game *game = new Game();
    if (!game->GameInit(hInstance))
        return false;

    MSG msg;
    ZeroMemory(&msg, sizeof(msg));

    while (msg.message != WM_QUIT)
    {
        if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
        game->GameUpdate();
        game->GameDraw();
    }
    game->GameRelease();
    return 0;
}