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; }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, PSTR cmdLine, int showCmd) { InitAllocCheck(ACOutput_XML); // ACOutput_XML // Enable run-time memory check for debug builds. #if defined(DEBUG) | defined(_DEBUG) _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif Game app(hInstance, "Nyctophobia", SCREEN_WIDTH, SCREEN_HEIGHT, D3DDEVTYPE_HAL, D3DCREATE_HARDWARE_VERTEXPROCESSING); gGame = &app; gInput = new Input(); gMath = new Math(); gScript = new Script(); gFileInput = new FileInput(); gLightHandler = new LightHandler(); /* this is where the game is ran */ return gGame->run(); }