AnimController::~AnimController() { if(current != nullptr) { ReleaseInstance(current); } }
bool NNApplication::Release() { if ( m_DestroyWindow == true ) { ReleaseInstance(); return true; } m_pSceneDirector->Release(); NNSceneDirector::ReleaseInstance(); NNResourceManager::ReleaseInstance(); NNInputSystem::ReleaseInstance(); NNAudioSystem::ReleaseInstance(); SafeDelete( m_Renderer ); ReleaseInstance(); return true; }
void AnimController::Stop() { if(current != nullptr) { ReleaseInstance(current); current = nullptr; } }
void ClearBloadedExpressions( Environment *theEnv) { unsigned long i; size_t space; /*===============================================*/ /* Update the busy counts of atomic data values. */ /*===============================================*/ for (i = 0; i < ExpressionData(theEnv)->NumberOfExpressions; i++) { switch (ExpressionData(theEnv)->ExpressionArray[i].type) { case SYMBOL_TYPE : case STRING_TYPE : case INSTANCE_NAME_TYPE : case GBL_VARIABLE : ReleaseLexeme(theEnv,ExpressionData(theEnv)->ExpressionArray[i].lexemeValue); break; case FLOAT_TYPE : ReleaseFloat(theEnv,ExpressionData(theEnv)->ExpressionArray[i].floatValue); break; case INTEGER_TYPE : ReleaseInteger(theEnv,ExpressionData(theEnv)->ExpressionArray[i].integerValue); break; #if DEFTEMPLATE_CONSTRUCT case FACT_ADDRESS_TYPE : ReleaseFact((Fact *) ExpressionData(theEnv)->ExpressionArray[i].value); break; #endif #if OBJECT_SYSTEM case INSTANCE_ADDRESS_TYPE : ReleaseInstance((Instance *) ExpressionData(theEnv)->ExpressionArray[i].value); break; #endif case VOID_TYPE: break; default: if (EvaluationData(theEnv)->PrimitivesArray[ExpressionData(theEnv)->ExpressionArray[i].type] == NULL) break; if (EvaluationData(theEnv)->PrimitivesArray[ExpressionData(theEnv)->ExpressionArray[i].type]->bitMap) { DecrementBitMapReferenceCount(theEnv,(CLIPSBitMap *) ExpressionData(theEnv)->ExpressionArray[i].value); } break; } } /*===================================*/ /* Free the binary expression array. */ /*===================================*/ space = ExpressionData(theEnv)->NumberOfExpressions * sizeof(struct expr); if (space != 0) genfree(theEnv,ExpressionData(theEnv)->ExpressionArray,space); ExpressionData(theEnv)->ExpressionArray = 0; }
int main(void) { struct tagApple * pApple; pApple= GetInstance(); SetColor(pApple, 1); int color = GetColor(pApple); printf("color = %d/n", color); ReleaseInstance(&pApple); assert(pApple == 0); return 0; }
void AnimController::UpdateInstance(Instance* instance, unsigned elapsed) { ResourceAnimation* anim = static_cast<ResourceAnimation*>(App->resources->Get(instance->clip)); if (anim != nullptr && anim->GetDuration() > 0) { unsigned me_elapsed = unsigned(elapsed*instance->speed); me_elapsed = me_elapsed % anim->GetDuration(); unsigned to_end = anim->GetDuration() - instance->time; if (me_elapsed <= to_end) { instance->time += me_elapsed; } else if (instance->loop) { instance->time = (me_elapsed - to_end); } else { instance->time = anim->GetDuration(); } assert(instance->time <= anim->GetDuration()); } if(instance->next != nullptr) { unsigned to_end = instance->fade_duration-instance->fade_time; if(elapsed <= to_end) { instance->fade_time += elapsed; UpdateInstance(instance->next, elapsed); } else { ReleaseInstance(instance->next); instance->next = nullptr; instance->fade_time = instance->fade_duration = 0; } } }