int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hprev, PSTR cmdline, int ishow) { #ifdef DEBUG_CONSOLE g_log = new CDebug; #endif CIrc *irc = new CIrc(); //Module Objects #ifdef ENABLE_SYSTEM // CSystem sys(cmdHandler); #endif irc->start(); irc->waitThread(); DELETE_OBJECT(irc); #ifdef DEBUG_CONSOLE DELETE_OBJECT(g_log); #endif _CrtDumpMemoryLeaks(); return 0; }
__fastcall TExtendedButton::~TExtendedButton(void) { DELETE_OBJECT(this->FBase); DELETE_OBJECT(this->FPaintBox); DELETE_OBJECT(this->FDrawingBuffer); return; }
void __fastcall TfrmHelp::FormClose(TObject *Sender, TCloseAction &Action) { this->SaveFormState(); DELETE_OBJECT(this->FContextMenu); DELETE_OBJECT(this->FSearchButton); Action = Forms::caFree; return; }
__fastcall TfrmBaseConverter::~TfrmBaseConverter(void) { //--------------------------------------------------------------------------- // Save the form's values this->Base->SaveSetting(basc::ST_BASE_CONVERTER_FROM_BASE, std::string(AnsiString(this->cmbBaseFrom->Text).c_str())); this->Base->SaveSetting(basc::ST_BASE_CONVERTER_TO_BASE, std::string(AnsiString(this->cmbBaseTo->Text).c_str())); //--------------------------------------------------------------------------- this->SaveFormState(); DELETE_OBJECT(this->FFromBaseContextMenu); DELETE_OBJECT(this->FToBaseContextMenu); return; }
void CCSceneBase::removeChildScene(CCSceneBase *inScene) { if( childScenes.remove( inScene ) ) { DELETE_OBJECT( inScene ); } }
void RenderTechnique::validatePassesInput( Pass* pass ) { if( pass->outputCanvas ) for( PassElm p = m_passes.FirstPointer(); !p.IsEmpty(); p.Next() ) { for( unsigned int i = 0; i < p()->inputTextures.Size(); i++ ) { if( !p()->inputTextures[ i ] ) continue; XeCore::Photon::XeElmTexture it = p()->inputTextures[ i ]->getTexture(); XeCore::Photon::XeElmTexture ct = pass->outputCanvas->getTexture(); XeCore::Photon::XeElmTexture dt = pass->outputCanvas->getTextureDepth(); if( it == ct || it == dt ) { if( p()->inputTexturesMine[ i ] ) { Texture* t = p()->inputTextures[ i ]; DELETE_OBJECT( t ); } p()->inputTextures[ i ] = 0; } } rebuildPassMaterialTextures( p ); } }
void TitleDlg::OnDestroy(void) { CDialog::OnDestroy(); DELETE_OBJECT(mTitleFont); DESTROY_ICON(mDescIcon); }
bool CCInterpolatorListV3<T>::update(const float delta) { updating = false; if( interpolators.length > 0 ) { CCInterpolatorV3<T> *interpolator = interpolators.list[0]; if( interpolator->update( delta * speed ) == false ) { interpolators.remove( interpolator ); DELETE_OBJECT( interpolator ); // If there's another interpolation planned, tell it to ready itself to interpolate if( interpolators.length > 0 ) { interpolators.list[0]->ready(); } else { return false; } } updating = true; } return updating; }
void CCEngine::updateLoop() { #if defined PROFILEON CCProfiler profile( "CCEngine::updateGame()" ); #endif // Remove any redundant scenes for( int i=0; i<scenes.length; ++i ) { CCSceneBase *scene = scenes.list[i]; if( scene->shouldDelete() ) { removeScene( scene ); i--; } } CCNativeThreadLock(); for( int i=0; i<cameras.length; ++i ) { CCCameraBase *camera = cameras.list[i]; camera->updateControls(); } controls->update( time ); CCNativeThreadUnlock(); // Allow scene to handle the controls first for( int i=0; i<scenes.length; ++i ) { if( scenes.list[i]->updateControls( time ) ) { // If we're not releasing our touch if( controls->getScreenTouches()[0].usingTouch != NULL ) { break; } } } // Run through our controllers first for( int i=0; i<updaters.length; ++i ) { // Delete on finish update CCUpdater *updater = updaters.list[i]; if( updater->update( time.delta ) == false ) { updaters.remove( updater ); DELETE_OBJECT( updater ); } } // Update scene logic for( int i=0; i<scenes.length; ++i ) { CCSceneBase *scene = scenes.list[i]; scene->update( time ); } }
CFileEnumBase::~CFileEnumBase() { while (!m_queueFinder.empty()) { CBaseFileFinder *pFinder = m_queueFinder.front(); m_queueFinder.pop(); DELETE_OBJECT(pFinder); } }
bool Manager::_popState( IProgressState* newpstate ) { if( !m_states->current() ) return( false ); if( !newpstate ) newpstate = m_progressStateDefault; m_engine->resetTimer(); m_states->current()->onExit(); m_engine->resetTimer(); ActorManager* am = m_actors->current(); DELETE_OBJECT( am ); m_actors->pop(); ControlManager* ctm = m_controls->current(); DELETE_OBJECT( ctm ); m_controls->pop(); CollisionManager* clm = m_collisions->current(); DELETE_OBJECT( clm ); m_collisions->pop(); IState* s = m_states->current(); DELETE_OBJECT( s ); m_states->pop(); m_assets->releaseLevel( m_states->count() + 1 ); IState* c = m_states->current(); if( !m_changeState && c ) { if( newpstate ) { m_loading = true; newpstate->onEnter(); m_loading = false; } m_engine->resetTimer(); c->onEnter( newpstate ); m_engine->resetTimer(); if( newpstate ) { m_loading = true; newpstate->onExit(); m_loading = false; m_assetsLoading->releaseLevel( m_states->count() + 1 ); } } return( true ); }
bool RenderTechnique::removePass( PassElm& pass ) { if( pass.IsEmpty() ) return( false ); Pass* p = pass(); validatePassesInput( p ); DELETE_OBJECT( p ); m_passes.ErasePointer( pass ); return( true ); }
RenderTechnique::Pass::~Pass() { if( outputCanvas ) { outputScene->setCanvas( 0 ); DELETE_OBJECT( outputCanvas ); } outputQuad->setMaterial( 0 ); DELETE_OBJECT( outputMaterial ); DELETE_OBJECT( outputQuad ); DELETE_OBJECT( outputScene ); for( unsigned int i = 0; i < inputTextures.Size(); i++ ) if( inputTexturesMine[ i ] ) { Texture* t = inputTextures[ i ]; DELETE_OBJECT( t ); } inputTextures.Free(); inputTexturesMine.Free(); }
void CCEngine::removeScene(CCSceneBase* scene) { if( scenes.remove( scene ) ) { DELETE_OBJECT( scene ); } else { ASSERT( false ); } }
bool RenderTechnique::removePass( NameID& name ) { for( PassElm p = m_passes.FirstPointer(); !p.IsEmpty(); p.Next() ) if( p() && name == p()->name ) { Pass* pass = p(); validatePassesInput( pass ); DELETE_OBJECT( pass ); m_passes.ErasePointer( p ); return( true ); } return( false ); }
void CCSceneBase::destruct() { deleteLater(); childScenes.deleteObjectsAndList(); while( objects.length > 0 ) { CCObject *object = objects.list[0]; DELETE_OBJECT( object ); } CCASSERT( collideables.length == 0 ); }
bool RenderTechnique::unbindPassInputTexture( PassElm& pass, unsigned int unit ) { if( pass.IsEmpty() ) return( false ); if( unit >= pass()->inputTextures.Size() ) return( false ); if( pass()->inputTexturesMine[ unit ] ) { Texture* t = pass()->inputTextures[ unit ]; DELETE_OBJECT( t ); } pass()->inputTextures[ unit ] = 0; rebuildPassMaterialTextures( pass ); return( true ); }
RenderTechnique::PassElm RenderTechnique::addPass( NameID& name, unsigned int texCount, Effect* effect, int width, int height, bool flipH, bool flipV, bool renderToCanvas ) { for( PassElm p = m_passes.FirstPointer(); !p.IsEmpty(); p.Next() ) if( p() && name == p()->name ) return( PassElm() ); if( static_cast<int>(texCount) > Global::use().engine->getTextureUnitsCount() ) return( PassElm() ); Engine::WindowRect wr; Global::use().engine->getWindowRect( wr ); if( width <= 0 ) width = wr.width; if( height <= 0 ) height = wr.height; Pass* p = new Pass( name ); PassElm pass = m_passes.AddPointer( p ); if( pass.IsEmpty() ) { DELETE_OBJECT( p ); return( PassElm() ); } p->inputTextures.Reserve( texCount ); p->inputTexturesMine.Reserve( texCount ); for( unsigned int i = 0; i < p->inputTextures.Size(); i++ ) { p->inputTextures[ i ] = 0; p->inputTexturesMine[ i ] = false; } p->outputMaterial = xnew Material(); p->outputMaterial->setEffect( effect ); p->outputScene = xnew SpriteBatch( 1 ); p->outputScene->setCamera( xnew Camera2D( 0.0f, 0.0f, static_cast<float>(width), static_cast<float>(height), 0.0f ) ); p->outputQuad = xnew SpriteBatch::Sprite(); p->outputQuad->setMaterial( p->outputMaterial ); p->outputQuad->setWidth( static_cast<float>(width) ); p->outputQuad->setHeight( static_cast<float>(height) ); if( flipH ) p->outputQuad->flip( SpriteBatch::Sprite::ftHorizontal ); if( flipV ) p->outputQuad->flip( SpriteBatch::Sprite::ftVertical ); p->outputScene->attach( p->outputQuad ); if( renderToCanvas ) { p->outputCanvas = xnew Canvas( width, height ); p->outputScene->setCanvas( p->outputCanvas ); p->outputCanvas->setClearOnActivate( true ); } return( pass ); }
bool StopPhoneNotification() { DELETE_OBJECT(g_psnIncomingCall); DELETE_OBJECT(g_psnTalkingCallerNumber); DELETE_OBJECT(g_psnTalkingCallerName); DELETE_OBJECT(g_psnTalkingCallerContact); DELETE_OBJECT(g_psnCallTalking); DELETE_OBJECT(g_pRecorder); return true; }
GdiFont::~GdiFont(void) { size_t size = m_FontTextures.size(); while (m_FontTextures.empty()==false) { HTEXTURE hTex = m_FontTextures.front(); m_FontTextures.pop_front(); m_pHGE->Texture_Free(hTex); } if ((m_hBitmap)) DeleteObject(m_hBitmap); if ((m_hFont)) DeleteObject(m_hFont); if ((m_hBrush)) DeleteObject(m_hBrush); if ((m_hMemDC)) DeleteDC(m_hMemDC); DELETE_OBJECT(m_pSprite); RELEASE_OBJECT(m_pHGE); }
// CCSceneBase bool SceneSplashScreen::updateScene(const CCTime &time) { bool updated = super::updateScene( time ); // Run through our controllers first for( int i=0; i<updaters.length; ++i ) { // Delete on finish update CCUpdater *updater = updaters.list[i]; if( updater->update( time.delta ) == false ) { updaters.remove( updater ); updater->finish(); DELETE_OBJECT( updater ); } } return updated; }
void CCPrimitiveObj::LoadObj(const char *file, const CCResourceType resourceType, CCLambdaCallback *callback) { CCPrimitiveObj *primitive = NULL; CCText fileData; int fileSize = CCFileManager::GetFile( file, fileData, resourceType ); if( fileSize > 0 ) { CCPrimitiveObj *primitive = new CCPrimitiveObj(); bool success = primitive->loadData( fileData.buffer ); if( success == false ) { DELETE_OBJECT( primitive ); } } callback->runParameters = primitive; callback->safeRun(); }
void GameScene::_dispose() { Scene::_dispose(); // Dispose text SDL_FreeSurface(mTextSurface); mTextSurface = nullptr; mGameplay = static_cast<GameplayState*>(DELETE_OBJECT(mGameplay)); // Dispose text /* SDL_FreeSurface(mTextSurface); mTextSurface = nullptr; */ // Dispose image (owned by me) // SDL_FreeSurface(mBackgroundImage); not owned by me mBackgroundImage = nullptr; mGridImage = nullptr; }
void CCSceneObject::destruct() { if( inScene != NULL ) { removeFromScene(); } else if( parent == NULL ) { ASSERT( false ); } else { parent->removeChild( this ); } children.deleteObjectsAndList(); updaters.deleteObjectsAndList(); DELETE_OBJECT( model ); super::destruct(); }
bool CCSceneBase::updateScene(const CCTime &time) { bool updated = false; for( int i=0; i<objects.length; ++i ) { CCObject *object = objects.list[i]; if( object->isActive() ) { updated |= object->update( time ); } else if( object->deleteMe > 0 ) { if( --object->deleteMe == 0 ) { DELETE_OBJECT( object ); --i; } } } return updated; }
bool CSimpleMesh::LoadFromObjFile(char *szFileName) { TArray<VECTOR3Df> m_oVertexArray; TArray<VECTOR3Df> m_oNormalArray; TArray<VECTOR2Df> m_oTextureCoordArray; m_oMaterials.RemoveAll(); m_oMaterialNames.RemoveAll(); m_oSubsetsStartIndex.RemoveAll(); m_oSubsetsMaterialIndex.RemoveAll(); FreeTexureArray(); m_oMaterialsTextureIndex.RemoveAll(); TArray<FACE_STRUCT> oFaceBuffer; #ifdef USE_HASHTABLE_FOR_VERTEX_SEARCH THashTable<FACE_STRUCT> oFaceHash(NUM_KEYS, FACE_STRUCT::GetKey); #endif //USE_HASHTABLE_FOR_VERTEX_SEARCH TArray<unsigned short> oIndexBuffer; DELETE_OBJECT(m_poVB); DELETE_OBJECT(m_poIB); FILE *file = fopen(szFileName, "rt"); if (!file) return false; char szLine[MAX_LINE_LEN]; CString *ppsTokens; int iNumTokens; int iNumIndexes = 0; while (fgets(szLine, MAX_LINE_LEN, file)) { CString sLine(szLine); sLine.ToUpper(); sLine.Tokenize(&ppsTokens, &iNumTokens, sDelimiters); if (iNumTokens == 0) continue; if (ppsTokens[0].Equals("MTLLIB")) { LoadMaterials(ppsTokens[1]); } else if (ppsTokens[0].Equals("VN")) { m_oNormalArray.Append(VECTOR3Df(ppsTokens[1].ToFloat(), ppsTokens[2].ToFloat(), ppsTokens[3].ToFloat())); } else if (ppsTokens[0].Equals("VT")) { m_oTextureCoordArray.Append(VECTOR2Df(ppsTokens[1].ToFloat(), ppsTokens[2].ToFloat())); } else if (ppsTokens[0].Equals("V")) { m_oVertexArray.Append(VECTOR3Df(ppsTokens[1].ToFloat(), ppsTokens[2].ToFloat(), ppsTokens[3].ToFloat())); } else if (ppsTokens[0].Equals("USEMTL")) { int iMaterialIndex = m_oMaterialNames.Find(ppsTokens[1]); m_oSubsetsMaterialIndex.Append(iMaterialIndex); m_oSubsetsStartIndex.Append(oIndexBuffer.GetSize()); } else if (ppsTokens[0].Equals("F")) { struct FACE_STRUCT face; for (int i = 0; i < 3; i++) { face.iVertexIndex = ppsTokens[i * 3 + 1].ToInt() - 1; face.iTextureIndex = ppsTokens[i * 3 + 2].ToInt() - 1; face.iNormalIndex = ppsTokens[i * 3 + 3].ToInt() - 1; #ifndef USE_HASHTABLE_FOR_VERTEX_SEARCH int index = oFaceBuffer.Find(face); if (index == -1) { oIndexBuffer.Append(oFaceBuffer.GetSize()); oFaceBuffer.Append(face); } else { oIndexBuffer.Append(index); } #else FACE_STRUCT *found = oFaceHash.Find(face); if (found) { int index = found->iIndex; oIndexBuffer.Append(index); } else { face.iIndex = iNumIndexes++; oFaceHash.Insert(face); oIndexBuffer.Append(oFaceBuffer.GetSize()); oFaceBuffer.Append(face); } #endif //USE_HASHTABLE_FOR_VERTEX_SEARCH } } SAFE_DELETE_ARRAY(ppsTokens); } m_oSubsetsStartIndex.Append(oIndexBuffer.GetSize()); fclose(file); m_poIB = new CIndexBuffer(oIndexBuffer.GetSize()); memcpy(m_poIB->GetIndexBuffer(), &oIndexBuffer[0], oIndexBuffer.GetSize() * sizeof(unsigned short)); m_bHasTextures = m_oTextures.GetSize() > 0; m_bHasMaterials = m_oMaterials.GetSize() > 0; int iFormat = VERTEXFORMAT_XYZ | VERTEXFORMAT_NORMAL | (m_bHasTextures ? VERTEXFORMAT_TEXTURE : 0); m_poVB = new CVertexBuffer(iFormat, oFaceBuffer.GetSize()); int iIndex = 0, iNumVertex = oFaceBuffer.GetSize(); for (int i = 0; i < iNumVertex; i++) { float *pVertex = (float *)m_poVB->GetVertexAtIndex(i); memcpy(pVertex, &m_oVertexArray[oFaceBuffer[i].iVertexIndex], 3 * sizeof(float)); memcpy(pVertex + 3, &m_oNormalArray[oFaceBuffer[i].iNormalIndex], 3 * sizeof(float)); if (m_bHasTextures) memcpy(pVertex + 6, &m_oTextureCoordArray[oFaceBuffer[i].iTextureIndex], 2 * sizeof(float)); } return true; }
Crate::~Crate() { DELETE_OBJECT( m_sprite ); ICollisional::unbind(); }
CSimpleMesh::~CSimpleMesh() { DELETE_OBJECT(m_poVB); DELETE_OBJECT(m_poIB); FreeTexureArray(); }
void Manager::setDefaultProgressState( IProgressState* newpstate ) { DELETE_OBJECT( m_progressStateDefault ); m_progressStateDefault = newpstate; }
Manager::~Manager() { while( m_actors->current() ) { ActorManager* am = m_actors->current(); DELETE_OBJECT( am ); m_actors->pop(); } DELETE_OBJECT( m_assets ); Global::use().assets = 0; DELETE_OBJECT( m_assetsLoading ); Global::use().assetsLoading = 0; DELETE_OBJECT( m_actors ); Global::use().actors = 0; DELETE_OBJECT( m_controls ); Global::use().controls = 0; DELETE_OBJECT( m_collisions ); Global::use().collisions = 0; DELETE_OBJECT( m_effects ); Global::use().effects = 0; DELETE_OBJECT( m_fonts ); Global::use().fonts = 0; DELETE_OBJECT( m_textures ); Global::use().textures = 0; DELETE_OBJECT( m_canvases ); Global::use().canvases = 0; DELETE_OBJECT( m_materials ); Global::use().materials = 0; DELETE_OBJECT( m_scenes ); Global::use().scenes = 0; DELETE_OBJECT( m_audio ); Global::use().audio = 0; m_engine->closure(); DELETE_OBJECT( m_engine ); Global::use().engine = 0; DELETE_OBJECT( m_states ); m_game = 0; DELETE_OBJECT( m_progressStateDefault ); }