int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShow) { D3DApp *app = D3DApp::GetApp(); if (app->Initialize(hInstance, width, height)) { app->Run(); } app->Destroy(); }
int main() { HINSTANCE hInstance = GetModuleHandle(NULL); D3DApp* demo = NULL; int result; int index; cout << "1、clear view." << endl; cout << "2、box." << endl; cout << "3、skull" << endl; cout << "4、terrain" << endl; cout << "5、lighting" << endl; cin >> index; switch (index) { case CLEAR_VIEW: demo = new D3dAppDemo1(hInstance); break; case BOX: demo = new CubeDemo(hInstance); break; case SKULL: demo = new ModelSkull(hInstance); break; case TERRAIN: demo = new Terrain(hInstance); break; case LIGHTING: demo = new LightDemo::LightingApp(hInstance); default: break; } if(!demo || !demo->Init() ) return 0; result = demo->Run(); delete demo; return result; }