Beispiel #1
0
void cxStackReplaceTop(cxStack stack,cxAny any)
{
    cxInt last = cxArrayLength(stack->array) - 1;
    if(last < 0){
        cxStackPush(stack, any);
    }else{
        cxArrayUpdate(stack->array, any, last);
    }
}
Beispiel #2
0
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);
    }
}
Beispiel #3
0
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);
    }
}
Beispiel #4
0
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);
}
Beispiel #5
0
#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;
Beispiel #6
0
void cxStackPop(cxStack stack)
{
    CX_RETURN(cxArrayLength(stack->array) == 0);
    cxArrayRemoveLast(stack->array);
}
Beispiel #7
0
cxInt cxStackLength(cxStack stack)
{
    return cxArrayLength(stack->array);
}
Beispiel #8
0
void cxStackPop(cxAny pstack)
{
    CX_ASSERT_THIS(pstack, cxStack);
    CX_RETURN(cxArrayLength(this->array) == 0);
    cxArrayRemoveLast(this->array);
}
Beispiel #9
0
cxInt cxStackLength(cxAny pstack)
{
    CX_ASSERT_THIS(pstack, cxStack);
    return cxArrayLength(this->array);
}