本文整理汇总了C++中safeDelete函数的典型用法代码示例。如果您正苦于以下问题:C++ safeDelete函数的具体用法?C++ safeDelete怎么用?C++ safeDelete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了safeDelete函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: releaseAll
//=============================================================================
// Delete all reserved memory
//=============================================================================
void Game::deleteAll()
{
releaseAll(); // call onLostDevice() for every graphics item
safeDelete(graphics);
safeDelete(input);
initialized = false;
}
示例2: stopMusic
bool AudioHandler::setMusic(const std::string& musicKey)
{
//Set current music playing.
stopMusic();
if(musicList.find(musicKey) == musicList.end())
{
std::cout << "Music not found";
return true;
}
if(song != NULL) safeDelete(song);
song = new sbe::Music();
if(!song->OpenFromFile(musicList[musicKey]))
{
Logger::writeMsg(1) << "Music could not be loaded!";
safeDelete(song);
return true;
}
song->SetVolume(mVol);
song->Initialize(2, 44100);
song->Play();
Logger::writeMsg(1) << "Music \"" << musicKey << "\" now playing.";
return false;
}
示例3: safeDelete
Lab3Canvas::~Lab3Canvas()
{
safeDelete(m_timer);
safeDelete(m_camera);
gluDeleteQuadric(m_quadric);
makeCurrent();
}
示例4: safeDelete
Kernel::~Kernel()
{
program->removeAllShaders();
safeDelete(fragmentShader);
safeDelete(vertexShader);
safeDelete(program);
}
示例5: assert
void CSystem::destroyContexts()
{
assert( G_RENDERCTX );
safeDelete( G_RENDERCTX );
assert( G_INPUTCTX );
safeDelete( G_INPUTCTX );
}
示例6: WinMain
//=============================================================================
// Starting point for a Windows application
//=============================================================================
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
// Check for memory leak if debug build
#if defined(DEBUG) | defined(_DEBUG)
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif
MSG msg;
// Create the game, sets up message handler
game = new TileCollision;
// Create the window
if (!CreateMainWindow(hwnd, hInstance, nCmdShow))
return 1;
try{
game->initialize(hwnd); // throws GameError
// main message loop
int done = 0;
while (!done)
{
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
// look for quit message
if (msg.message == WM_QUIT)
done = 1;
// decode and pass messages on to WinProc
TranslateMessage(&msg);
DispatchMessage(&msg);
} else
game->run(hwnd); // run the game loop
}
safeDelete(game); // free memory before exit
return msg.wParam;
}
catch(const GameError &err)
{
game->deleteAll();
DestroyWindow(hwnd);
MessageBox(NULL, err.getMessage(), "Error", MB_OK);
}
catch(...)
{
game->deleteAll();
DestroyWindow(hwnd);
MessageBox(NULL, "Unknown error occured in game.", "Error", MB_OK);
}
safeDelete(game); // free memory before exit
return 0;
}
示例7: delete
LyingShapesScene::~LyingShapesScene()
{
for (auto shapeIt = cubes.begin(); shapeIt != cubes.end(); shapeIt++)
{
delete (*shapeIt);
}
cubes.clear();
safeDelete(&grid);
safeDelete(&coords);
safeDelete(&mCubes);
}
示例8: safeDelete
void cCore::finalize()
{
safeDelete(m_gui);
safeDelete(m_renderer, true);
safeDelete(m_luaMgr);
safeDelete(m_classCreater);
safeDelete(m_msgMgr);
safeDelete(m_batchRenderMgr, true);
safeDelete(m_postProcessMgr, true);
safeDelete(m_fileSystem, true);
safeDelete(m_fileWatcher);
safeDelete(m_debugRenderMgr, true);
}
示例9: safeDelete
void FlowText::close()
{
if (mRunning)
{
gGlobalClient->getTimerAxis()->KillTimer(0, this);
mText.clear_wstr();
safeDelete(mPosX);
safeDelete(mPosY);
safeDelete(mAlpha);
safeDelete(mSize);
mRunning = false;
}
}
示例10: safeDelete
CWall3D::~CWall3D()
{
for( int i = 0; i < RMCOUNT; ++i ) {
safeDelete( mRenderables[i] );
}
safeDelete( mFadeInMesh );
stl_utils::wipe( mPiecesCombined );
safeDeleteArray( mPieces3D );
safeDeleteArray( mFracturedPieces );
safeDeleteArray( mPieceRestoreTimes );
safeDeleteArray( mQuadtree );
safeDeleteArray( mResTimeGrid );
}
示例11: assert
void AsynFileDevice::Close()
{
if ( m_hHandle!=INVALID_HANDLE_VALUE )
{
::CloseHandle(m_hHandle);
m_hHandle = INVALID_HANDLE_VALUE;
}
assert(m_pendingList.empty());
m_pendingList.clear();
safeDelete(m_pReader);
safeDelete(m_pWriter);
}
示例12: gWriteD3DSettingsPref
void CDemo::shutdown()
{
gWriteD3DSettingsPref();
CONS << "Shutting down..." << endl;
CGameInfo::finalize();
delete gDebugRenderer;
safeDelete( gUIDlg );
safeDelete( gUISettingsDlg );
safeDelete( gUIHelpDlg );
safeDelete( gUIGameSetupDlg );
CONS << "Done!" << endl;
}
示例13: memset
bool MemoryFileWriter::reallocate(size_t s)
{
if (s == 0)
{
return false;
}
size_t newSize = _cursor + s;
void* b = new char[newSize];
if (b == NULL)
{
return false;
}
memset(b, 0, newSize);
if (_cursor > 0)
{
memcpy(b, _buffer, _cursor);
}
safeDelete(_buffer);
_buffer = b;
_length = newSize;
return true;
}
示例14: safeDelete
void AudioHandler::fadeOut(float elapsed, const std::string& strM, float s)
{
//Fade out music during s seconds, or crossfade between song and strM if c = true.
if(fadeCounter != 0) return;
if(strM != "") cross = true;
fadeCounter = elapsed;
interval = mVol / s;
if(cross)
{
if(musicList.find(strM) == musicList.end())
std::cout << "Music not found";
crossSong = new sbe::Music();
if(!crossSong->OpenFromFile(musicList[strM]))
{
Logger::writeMsg(1) << "Music could not be loaded!";
safeDelete(crossSong);
}
crossSong->SetVolume(0);
crossSong->Initialize(2, 44100);
crossSong->Play();
Logger::writeMsg(1) << "Music \"" << strM << "\" now playing.";
}
}
示例15: glDeleteVertexArrays
Tessellator::~Tessellator()
{
glDeleteVertexArrays(1, &m_vaoID);
glDeleteBuffers(1, &m_bufferID);
glDeleteQueries(1, &m_primitivesQuery);
safeDelete(program);
}