int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); MSG msg; HACCEL hAccelTable; // Initialize global strings LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadString(hInstance, IDC_BASECODE, szWindowClass, MAX_LOADSTRING); MyRegisterClass(hInstance); // Perform application initialization: if (!InitInstance (hInstance, nCmdShow)) { return FALSE; } /*-------------------------- NEW CODE ---------------------------------*/ // set up the directx manager if(!dx.initialize(&hWnd)) { return FALSE; } /*---------------------------------------------------------------------*/ hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_BASECODE)); // Main message loop: while (!quit) { if(PeekMessage(&msg, NULL, 0, 0, 1)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } // NEW CODE - render the current scene each time through Stats::startFPS(); dx.renderScene(); Stats::endFPS(); Utility::debugUpdate(); dx.update(); Stats::update(); } return (int) msg.wParam; }
/******************************************************************* * WinMain *******************************************************************/ int APIENTRY _tWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow ) { RedirectIOToConsole(); // Set up the application window if (!InitWindow( hInstance, nCmdShow, hWnd)) return 0; //set up direct x manager if (!dx.initialize(&hWnd , &hInstance)) return 0; // showing cursor: //ShowCursor(TRUE); //hTimer.StartTimer(); // Main message loop hTimer.Reset(); MSG msg = {0}; while (WM_QUIT != msg.message) { if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) == TRUE) { TranslateMessage(&msg); DispatchMessage(&msg); } else { //hTimer. hTimer.UpdateTime(); dx.renderScene(&hTimer); } } return (int) msg.wParam; }