int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow) { MSG msg; WINDOWPLACEMENT w; BOOL bQuit = FALSE; InitCommonControls(); hInst = hInstance; // Find location of configuration file ConfigInit(); /* Register our custom classes */ RegisterWindowClasses(); hMain = CreateWindow(szAppName, /* window class name */ szAppName, /* window caption */ WS_OVERLAPPEDWINDOW, /* window style */ 0, 0, 0, 0, /* initially zero size; changed below */ NULL, /* parent window handle */ NULL, /* window menu handle */ hInstance, /* program instance handle */ NULL); /* creation parameters */ if (!hMain) { char buf[256]; DWORD err = GetLastError(); sprintf(buf, "Error - Couldn't Create Client Window : %d", err); MessageBox(NULL, buf, "ERROR!", MB_OK); MainQuit(hMain); exit(1); } if (config.debug) CreateDebugWindow(); if (lpszCmdParam && strlen(lpszCmdParam) > 0) ConfigOverride(lpszCmdParam); w.length = sizeof(WINDOWPLACEMENT); WindowSettingsLoad(&w); SetWindowPlacement(hMain, &w); D3DRenderInit(hMain); ModulesInit(); // Set up data structures for modules /* attempt make a crc16 on the meridian.exe */ GenerateCRC16(); MainInitState(STATE_OFFLINE); UpdateWindow(hMain); while (!bQuit) { MainIdle(); while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { if (!GetMessage(&msg, NULL, 0, 0)) { bQuit = TRUE; break; } // Forward appropriate messages for tooltips if (state == STATE_GAME) TooltipForwardMessage(&msg); /* Handle modeless dialog messages separately */ if ((hCurrentDlg == NULL || !IsDialogMessage(hCurrentDlg, &msg))) { TranslateMessage(&msg); DispatchMessage(&msg); } } } /* Unregister our custom classes--not good to leave them around */ UnregisterWindowClasses(); return msg.wParam; // Return value of PostQuitMessage }
} void GameFramework::Shutdown( void ) { Framework::Shutdown(); } Error GameFramework::Execute( void ) throw ( ... ) { // // Create the debug window. // #ifdef __ALLOW_DEBUG_WINDOW__ if ( Singletons::EnvironmentManager.Variables().GetAsBool( "Framework::DebugWindow", False ) ) { m_hDebugWindow = CreateDebugWindow(); } #endif // // Process the link messages in the CCMs first, for both the object and scene CCMs. The link // needs to be established before any other messages come through. // m_pObjectCCM->DistributeQueuedChanges( System::Types::All, System::Changes::Link | System::Changes::ParentLink ); m_pSceneCCM->DistributeQueuedChanges( System::Types::All, System::Changes::Link | System::Changes::ParentLink ); //