void cxStackReplaceTop(cxStack stack,cxAny any) { cxInt last = cxArrayLength(stack->array) - 1; if(last < 0){ cxStackPush(stack, any); }else{ cxArrayUpdate(stack->array, any, last); } }
void cxStackReplaceTop(cxAny pstack,cxAny any) { CX_ASSERT_THIS(pstack, cxStack); cxInt last = cxArrayLength(this->array) - 1; if(last < 0){ cxStackPush(this, any); }else{ cxArrayUpdate(this->array, any, last); } }
static void cxTimeLineStep(cxAny pav,cxFloat dt,cxFloat time) { cxTimeLine this = pav; cxInt count = cxArrayLength(this->times); for(cxInt i = this->index + 1; i < count; i++){ cxNumber num = cxArrayAtIndex(this->times, i); cxFloat time = cxNumberToFloat(num); if(this->cxAction.durationElapsed >= time){ this->index = i; CX_EVENT_FIRE(this, onTime); continue; } break; } if(this->index == (count - 1)){ cxActionStop(this); } }
static void cxSplineInit(cxAny pav) { cxSpline this = pav; CX_ASSERT(this->super.view != NULL, "view not set"); this->delta = 1.0f/((cxFloat)cxArrayLength(this->points) - 1.0f); }
#include <core/cxEngine.h> #include <core/cxNumber.h> #include <core/cxActionRoot.h> #include "cxSpline.h" static void cxSplineInit(cxAny pav) { cxSpline this = pav; CX_ASSERT(this->super.view != NULL, "view not set"); this->delta = 1.0f/((cxFloat)cxArrayLength(this->points) - 1.0f); } static cxVec2f cxSplinePointAt(cxSpline this,cxInt idx) { idx = CX_MIN(cxArrayLength(this->points) - 1, CX_MAX(idx, 0)); cxNumber num = cxArrayAtIndex(this->points, idx); CX_ASSERT(num != NULL, "num error"); return cxNumberToVec2f(num); } static void cxSplineStep(cxAny pav,cxFloat dt,cxFloat time) { cxInt index = 0; cxSpline this = pav; cxFloat lt = 0; if (time >= 1.0f){ index = cxArrayLength(this->points) - 1; lt = 1.0f; }else{ index = time / this->delta;
void cxStackPop(cxStack stack) { CX_RETURN(cxArrayLength(stack->array) == 0); cxArrayRemoveLast(stack->array); }
cxInt cxStackLength(cxStack stack) { return cxArrayLength(stack->array); }
void cxStackPop(cxAny pstack) { CX_ASSERT_THIS(pstack, cxStack); CX_RETURN(cxArrayLength(this->array) == 0); cxArrayRemoveLast(this->array); }
cxInt cxStackLength(cxAny pstack) { CX_ASSERT_THIS(pstack, cxStack); return cxArrayLength(this->array); }