示例#1
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
	WNDCLASS wndclass;
	RECT rect;
	int nWidth, nHeight;
	MSG msg;

#ifdef STACKWALKER
	InitAllocCheck();
#endif
	memset(&wndclass, 0, sizeof(WNDCLASS));
	wndclass.style = CS_HREDRAW | CS_VREDRAW;
	wndclass.lpfnWndProc = (WNDPROC)WindowProc;
	wndclass.hInstance = hInstance;
	wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
	wndclass.lpszClassName = _T("GoodPlayerClass");
	RegisterClass(&wndclass);

	g_hInstance = hInstance;
	GetClientRect(GetDesktopWindow(), &rect);
	nWidth = 320;
	if (nWidth > rect.right)
		nWidth = rect.right;
	nHeight = 240;
	if (nHeight > rect.bottom)
		nHeight = rect.bottom;
	g_hMain = CreateWindow(wndclass.lpszClassName, _T("GoodPlayer"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, nWidth, nHeight, NULL, NULL, hInstance, NULL);
	ShowWindow(g_hMain, nCmdShow);
	UpdateWindow(g_hMain);

	if (lpCmdLine[0] != _T('\0'))
	{
		if (lpCmdLine[0] == _T('"'))
		{
			++lpCmdLine;
			lpCmdLine[_tcslen(lpCmdLine) - 1] = _T('\0');
		}
		OpenMedia(lpCmdLine);
	}

	while (GetMessage(&msg, NULL, 0, 0))
   	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
#ifdef STACKWALKER
	DeInitAllocCheck();
#endif
	return msg.wParam;
}
示例#2
0
Game::~Game()
{
	// :WARNING: Maybe needs to call ~Runnable()
	mGameState->cleanup();

	delete gInput;
	delete gGraphics;
	delete gScript;
	delete gFileInput;
	delete gLightHandler;
	delete gMath;
	//delete gGameState;
	delete mGfxStats;

	// Print memory leaks to xml file
	DeInitAllocCheck();
}