OMX_ERRORTYPE TextSource::Init() { CPresult ret = 0; ret = mPipe->Open(&mHandle, mUrl, CP_AccessRead); if(ret != 0) { LOG_ERROR("Can't open content: %s\n", mUrl); return OMX_ErrorUndefined; } mBuffer = (OMX_U8*)FSL_MALLOC(mBufferSize); if(mBuffer == NULL) { DeInit(); return OMX_ErrorInsufficientResources; } mCache = (OMX_U8*)FSL_MALLOC(mCacheSize); if(mCache == NULL) { DeInit(); return OMX_ErrorInsufficientResources; } mCacheRead = mCacheFill = 0; mOffset = 0; return OMX_ErrorNone; }
LRESULT CALLBACK WinProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) { LONG lRet = 0; PAINTSTRUCT ps; switch (uMsg) { case WM_SIZE: // If the window is resized if(!g_bFullScreen) // Do this only if we are NOT in full screen { SizeOpenGLScreen(LOWORD(lParam),HIWORD(lParam));// LoWord=Width, HiWord=Height GetClientRect(hWnd, &g_rRect); // Get the window rectangle } break; case WM_PAINT: // If we need to repaint the scene BeginPaint(hWnd, &ps); // Init the paint struct EndPaint(hWnd, &ps); // EndPaint, Clean up break; case WM_KEYDOWN: if(wParam == VK_ESCAPE) DeInit(); // Quit if we pressed ESCAPE break; case WM_DESTROY: // If the window is destroyed DeInit(); // Release memory and restore settings break; default: // Return by default lRet = DefWindowProc (hWnd, uMsg, wParam, lParam); break; } return lRet; // Return by default }
/** * @brief * Initializes the window connection */ void WindowConnection::Initialize(const DisplayMode *pDisplayMode, bool bFullscreen) { // De-init window DeInit(); // Display mode information given? if (pDisplayMode) { // Just copy over the given information m_sDisplayMode = *pDisplayMode; } else { // Use default settings m_sDisplayMode.vSize = m_pWidget->GetSize(); m_sDisplayMode.nColorBits = 32; m_sDisplayMode.nFrequency = 60; } // Initialize renderer surface handler InitWidget(bFullscreen); // Emit the initial events so other components can set their proper initial states if (bFullscreen) OnFullscreenMode(); else OnDisplayMode(); }
void CService::ServiceMainMember(DWORD argc, LPTSTR* argv, LPHANDLER_FUNCTION pf, LPTHREAD_START_ROUTINE pfnWTP) { DWORD dwErr = 0; __try { PreInit(); SetupHandlerInside(pf); LaunchWatcherThread(pfnWTP); SetStatus(SERVICE_START_PENDING, 1, kDefaultWaitTime ); if ( NTService::InitializeService( _theService, _params, false ) == 0 ) { SetStatus( SERVICE_RUNNING, 0, 0, SERVICE_ACCEPT_STOP ); _theService->start(); } else { CERR << NTEXT("Error initializing service") << std::endl; } } __except(dwErr = GetExceptionCode(), EXCEPTION_EXECUTE_HANDLER) { if(m_hServiceStatus) SetStatus(SERVICE_STOPPED, 0, 0, 0, dwErr, 0); } DeInit(); SetStatus(SERVICE_STOPPED, 0, 0, 0, dwErr, 0); }
/***************************************************************************//** * 函数名称: SetAttribute * 功能描述: 设置输入输出图片属性以及Scale算法。 * 参 数: srcFormat >> 源图像格式; * 参 数: dstFormat >> 目标图像格式; * 参 数: enAlogrithm >> Scale算法; * 返 回 值: * 其它说明: * 修改日期 修改人 修改内容 * ------------------------------------------------------------------------------ * 2011-10-28 Cloud 创建 *******************************************************************************/ void CFFScale::SetAttribute(PicFormat srcFormat, PicFormat dstFormat, SwsAlogrithm enAlogrithm) { m_srcFormat = srcFormat; m_dstFormat = dstFormat; m_enAlogrithm = enAlogrithm; DeInit(); }
VError DB4DJournalParser::SetEndOfJournal( uLONG8 inOperation ) { VError error = VE_OK; if ( fFileStream ) { CDB4DJournalData *journalData = NULL; error = SetCurrentOperation( inOperation, &journalData ); if ( journalData ) journalData->Release(); if ( error == VE_OK ) { sLONG8 filePos = fFileStream->GetPos(); error = DeInit(); if ( error == VE_OK ) { VFileDesc *fileDesc = NULL; error = fLogFile->Open( FA_READ_WRITE, &fileDesc ); if ( error == VE_OK ) { error = fileDesc->SetSize( filePos ); delete fileDesc; } if ( error == VE_OK ) fTotalOperationCount = fCurrentOperation; } } } else { error = VE_UNIMPLEMENTED; // not initialized } return error; }
WPARAM MainLoop() { MSG msg; while(1) // Do our infinate loop { // Check if there was a message if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if(msg.message == WM_QUIT) // If the message wasnt to quit break; TranslateMessage(&msg); // Find out what the message does DispatchMessage(&msg); // Execute the message } else // if there wasn't a message { /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * g_Camera.Update(); // Update the camera data /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * RenderScene(); // Update the screen every frame (Not good in a game) } } DeInit(); // Clean up and free all allocated memory return(msg.wParam); // Return from the program }
// Here is the WndProc that handles all the messages LRESULT CALLBACK WndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) { // Check which message was passed in switch (iMsg) { // This message is sent when the window is created (CreateWindow()) case WM_CREATE: // Create the double buffer and load the bitmaps Init(hwnd); break; case WM_RBUTTONDOWN: // By pressing the right mouse button you can switch animations SetSpriteState(&gMonster, ++gMonster.state % 4); break; // This message is sent when the window is destroyed case WM_DESTROY: // Free all the data and set everything back to normal, then post the quit message DeInit(); break; } // Process/handle the default messages return DefWindowProc (hwnd, iMsg, wParam, lParam); }
WPARAM MainLoop() { MSG msg; while(1) // Do our infinite loop { // Check if there was a message if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if(msg.message == WM_QUIT) // If the message wasn't to quit break; TranslateMessage(&msg); // Find out what the message does DispatchMessage(&msg); // Execute the message } else // If there wasn't a message { if(AnimateNextFrame(60)) // Make sure we only render 60 frames per second { RenderScene(); // Render the scene } } } DeInit(); // Clean up and free all allocated memory return(msg.wParam); // Return from the program }
WPARAM MainLoop() { MSG msg; while(1) // Do our infinate loop { // Check if there was a message if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if(msg.message == WM_QUIT) // If the message wasnt to quit break; TranslateMessage(&msg); // Find out what the message does DispatchMessage(&msg); // Execute the message } else // if there wasn't a message { RenderScene(); // Update the screen } } // Go through all the objects in the scene for(int i = 0; i < g_3DModel.numOfObjects; i++) { // Free the faces, normals, vertices, and texture coordinates. delete [] g_3DModel.pObject[i].pFaces; delete [] g_3DModel.pObject[i].pNormals; delete [] g_3DModel.pObject[i].pVerts; delete [] g_3DModel.pObject[i].pTexVerts; } DeInit(); // Clean up and free all allocated memory return(msg.wParam); // Return from the program }
CMeshObject::CMeshObject(IHashString *parentName, IHashString *name) : OBJECTTEMPLATE( CRenderManager, CMeshObject, IMeshObject, parentName, name ) { //Not sure if we want to add to hierarchy //AddToHierarchy(); DeInit(); }
BOOL CYTGetApp::InitInstance() { AfxEnableControlContainer(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif Init(); CMainDlg dlg; m_pMainWnd = &dlg; int nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } else if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is // dismissed with Cancel } DeInit(); // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE; }
WPARAM MainLoop() { MSG msg; while(1) // Do our infinite loop { // Check if there was a message if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if(msg.message == WM_QUIT) // If the message wasn't to quit break; TranslateMessage(&msg); // Find out what the message does DispatchMessage(&msg); // Execute the message } else // if there wasn't a message { if(AnimateNextFrame(60)) // Make sure we only animate 60 FPS { g_Camera.Update(); // Update the camera information RenderScene(); // Render the scene every frame } else { Sleep(1); // Let other processes work } } } DeInit(); // Clean up and free all allocated memory return(msg.wParam); // Return from the program }
WPARAM MainLoop() { MSG msg; // This is where we load our accelerators for keyboard shortcuts HACCEL hAccelTable = LoadAccelerators(g_hInstance, MAKEINTRESOURCE(IDR_ACCELERATOR1)); while(1) // Do our infinite loop { // Check if there was a message if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if(msg.message == WM_QUIT) // If the message wasn't to quit break; // Check if there was keyboard command - if not, process messages like normal if(!TranslateAccelerator(g_hWnd, hAccelTable, &msg)) { TranslateMessage(&msg); // Find out what the message does DispatchMessage(&msg); // Execute the message } RenderScene(); // Since no animation, only render when the user does something } } DeInit(); // Clean up and free all allocated memory return(msg.wParam); // Return from the program }
void Replay::Init(bool rec) { DeInit(); is_recorder = rec; replay_state = (rec) ? PAUSED_RECORD : PAUSED_PLAY; }
WPARAM MainLoop() { MSG msg; while(1) // Do our infinite loop { // Check if there was a message if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if(msg.message == WM_QUIT) // If the message wasn't to quit break; TranslateMessage(&msg); // Find out what the message does DispatchMessage(&msg); // Execute the message } else // if there wasn't a message { // Render the scene every frame to update the rotating cube RenderScene(); } } DestroyFont(); // This frees up our font display list DeInit(); // Release memory and restore settings return(msg.wParam); // Return from the program }
void GameState::Unload(void) { // THis needs to go first DeInit(); backdrop.Free(); terrainMesh.Destroy(); levelUp.Unload(); /* if (castleDoorLight) lightSourceManager->ReleaseLightSource(castleDoorLight); castleDoorLight=0; */ centeredMessage.Unload(); bottomMessage.Unload(); for (int i=0; i < NUMBER_OF_PERKS_TO_DRAW; i++) perkWidgets[i].Unload(); userChatMessageInput.Unload(); chatMessageContainer.Unload(); lightedSphere.Unload(); // In case they resize the screen in a multiplayer game don't let them keep playing with new stats rakClient->Disconnect(); rakServer->Disconnect(); }
int CGameRound::Init(CTable *table) { if (table == NULL) return 0; DeInit(); m_Table = table; m_AllPhases[GAME_PHASE_PRESTART] = new CPreStartPhase(this); if (m_AllPhases[GAME_PHASE_PRESTART] == NULL) return 0; m_AllPhases[GAME_PHASE_JUDGE] = new CJudgePhase(this); if (m_AllPhases[GAME_PHASE_JUDGE] == NULL) return 0; m_AllPhases[GAME_PHASE_DRAWCARD] = new CDrawCardPhase(this); if (m_AllPhases[GAME_PHASE_DRAWCARD] == NULL) return 0; m_AllPhases[GAME_PHASE_OUTCARD] = new COutCardPhase(this); if (m_AllPhases[GAME_PHASE_OUTCARD] == NULL) return 0; m_AllPhases[GAME_PHASE_THROWCARD] = new CThrowCardPhase(this); if (m_AllPhases[GAME_PHASE_THROWCARD] == NULL) return 0; m_AllPhases[GAME_PHASE_AFTER_THROWCARD] = new CAfterThrowCardPhase(this); if (m_AllPhases[GAME_PHASE_AFTER_THROWCARD] == NULL) return 0; m_CurrentPhase = m_AllPhases[GAME_PHASE_PRESTART]; return 1; }
Replay::Replay() : buf(NULL) , bufsize(0) , is_recorder(true) { DeInit(); }
COceanRenderObject::~COceanRenderObject() { DeInit(); if (m_bAddToHierarchy) { RemoveFromHierarchy(); } }
void Base_Ocean::Init(float worldsize, float gridsize){ DeInit(); World_Size = worldsize; Grid_Size = gridsize; size_t count = static_cast<size_t>(((World_Size/Grid_Size)/8)*(World_Size/Grid_Size)); Ocean_Grid_bits.resize(count); memset(&Ocean_Grid_bits[0], 0, count); }
//[-------------------------------------------------------] //[ Private virtual PLRenderer::Surface functions ] //[-------------------------------------------------------] bool SurfaceTextureBuffer::Init() { // First, de-initialize the old stuff DeInit(); // Can we use a nice frame buffer object? return CreateFBO(); }
/** * Deconstructor * */ cAllwinnerDevice::~cAllwinnerDevice() { DeInit(); //delete m_omx; //delete m_audio; delete m_mutex; }// end of method
/** * @brief * Destructor */ SurfaceTextureBuffer::~SurfaceTextureBuffer() { // De-initialize the OpenGL surface window DeInit(); // Delete texture buffer if (m_cTextureBufferHandler.GetResource()) delete m_cTextureBufferHandler.GetResource(); }
CPickingPhysicsObject::~CPickingPhysicsObject() { DeInit(); if( m_bAddToHierarchy ) { RemoveFromHierarchy(); } }
CTriggerPhysicsObject::~CTriggerPhysicsObject() { DeInit(); if( m_bAddToHierarchy ) { RemoveFromHierarchy(); } }
WPARAM MainLoop() { MSG msg; // This is where we load our accelerators for keyboard shortcuts HACCEL hAccelTable = LoadAccelerators(g_hInstance, MAKEINTRESOURCE(IDR_ACCELERATOR1)); while(g_Player.IsAlive()) // Loop until the player is dead { // Check if there was a message if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if(msg.message == WM_QUIT) // If the message was to quit break; // Check if there was keyboard command - if not, process messages like normal if(!TranslateAccelerator(g_hWnd, hAccelTable, &msg)) { TranslateMessage(&msg); // Find out what the message does DispatchMessage(&msg); // Execute the message } // Here is where we handle the main game input HandleGameInput(); // Let's draw the map when we need to draw (if the draw flag == true). g_Map.Draw(); // Just like the g_Map.Draw() command, we will attempt to draw the menu, but it // will only be draw if it's draw flag is set to true. This is the main menu. g_Menu.Draw(); // Swap the backbuffers to display the bitmaps to the screen g_Buffer.SwapBackBuffer(FALSE); } // We want the Npcs to freely walk around so we need to move them every frame g_Map.MoveNpcs(); // Move the monsters randomly around the map g_Map.MoveMonsters(); } // If the player died because they were killed, let's display a death sound if(!g_Player.IsAlive()) { // We use PlaySound() to play our .wav files PlaySound("Death.wav", NULL, SND_FILENAME | SND_ASYNC); g_Menu.DrawMessageBox("You have perished!"); Sleep(1000); } // Clean up and free all allocated memory DeInit(); // Return from the program return(msg.wParam); }
bool CDX9TextureObject::MakeBlankTexture( UINT sizex, UINT sizey, UINT colordepth, IHashString * hformat, UINT mips ) { DeInit(); LPDIRECT3DDEVICE9 pDevice; if( !m_Renderer ) { return false; } pDevice = (LPDIRECT3DDEVICE9)m_Renderer->GetAPIDevice(); if( !pDevice ) { return false; } UINT numMips = mips; CDX9Renderer * crend = dynamic_cast<CDX9Renderer*>(m_Renderer); D3DFORMAT format = D3DFMT_A8R8G8B8; if( hformat ) { format = EEDX9FormatFromString( hformat ); if( format == D3DFMT_UNKNOWN ) { format = D3DFMT_A8R8G8B8; } m_Compressed = EEDX9IsCompressedFormat( format ); } else format = EEDX9FormatFromColorBits( colordepth ); //create new texture LPDIRECT3DTEXTURE9 temptex; //TODO: more control over texture creation? if(FAILED(pDevice->CreateTexture( sizex, //width sizey, //height numMips, //number of mips 0, //usage - 0 unless for render targets format, D3DPOOL_MANAGED, //TODO: managed vs. Unmanaged! unmanaged you can't lock! &temptex, NULL))) { return false; } if( !temptex ) { return false; } m_Texture = temptex; m_Height = sizey; m_Width = sizex; m_ColorDepth = colordepth; m_bRenderTarget = false; return true; }
CDDACodec::~CDDACodec() { DeInit(); if (m_Buffer) { delete[] m_Buffer; m_Buffer = NULL; } }
CLameDecoder::~CLameDecoder() { if(m_pDebug != NULL) { delete m_pDebug; m_pDebug = NULL; } DeInit(); }