void GameEngine::initializePostMenu() { OggPlayer* bgMusic = OggController::getOggPlayer(g_bgMusicHandle); bgMusic->play(); m_levelObjects->startLevel(); GameObjects objects = m_levelObjects->getAllObjects(); CHUint sz = (CHUint)objects.size(); for( CHUint i=0; i<sz; ++i ) m_objectScroller->addObject( objects[i] ); }
INT WINAPI wWinMain( HINSTANCE hInst, HINSTANCE, LPWSTR, INT ) { g_ogg.open("../sample video/trailer_400p.ogg",AF_S16,2,44100,VF_BGRA); if(g_ogg.fail()) { return -1; } // Register the window class WNDCLASSEX wc = { sizeof( WNDCLASSEX ), CS_CLASSDC, MsgProc, 0L, 0L, GetModuleHandle( NULL ), NULL, NULL, NULL, NULL, L"liboggstream", NULL }; RegisterClassEx( &wc ); int width=g_ogg.width(); int height=g_ogg.height(); // Create the application's window RECT rect; rect.left = 100; rect.top = 100; rect.right = width+rect.left; rect.bottom = height+rect.top; AdjustWindowRect(&rect,WS_OVERLAPPEDWINDOW,FALSE); HWND hWnd = CreateWindow( L"liboggstream", L"D3D9 Theora Player", WS_OVERLAPPEDWINDOW, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, NULL, NULL, wc.hInstance, NULL ); // Initialize Direct3D and OpenAL if( SUCCEEDED( InitD3D( hWnd ) ) && InitAL()) { // Show the window ShowWindow( hWnd, SW_SHOWDEFAULT ); UpdateWindow( hWnd ); // Start the playback g_ogg.play(); // Run MixAudio in another thread HANDLE h_mixaudio= CreateThread(NULL,0,MixAudio,NULL,0,NULL); // Enter the message loop MSG msg; ZeroMemory( &msg, sizeof( msg ) ); while( msg.message != WM_QUIT && g_ogg.playing() ) { if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); }else { Render(); Sleep(0); } } g_ogg.close(); WaitForSingleObject(h_mixaudio,INFINITE); alutExit(); } UnregisterClass( L"liboggstream", wc.hInstance ); return 0; }