Esempio n. 1
0
CX_SETTER_DEF(cxSpline, points)
{
    cxJson points = cxJsonToArray(value);
    CX_JSON_ARRAY_EACH_BEG(points, item)
    {
        cxVec2f point = cxJsonToVec2f(item, cxVec2fv(0, 0));
        cxSplineAppend(this, point);
    }
Esempio n. 2
0
CX_SETTER_DEF(cxTimeLine, times)
{
    cxJson times = cxJsonToArray(value);
    CX_JSON_ARRAY_EACH_BEG(times, item)
    {
        cxFloat time = cxJsonToDouble(item, -1);
        CX_CONTINUE(time < 0);
        cxTimeLineSet(this, time);
    }
Esempio n. 3
0
CX_SETTER_DEF(cxStack, items)
{
    CX_ASSERT(cxJsonIsArray(value), "items must is array");
    cxJson items = cxJsonToArray(value);
    CX_JSON_ARRAY_EACH_BEG(items, v)
    cxAny any = cxJsonTocxObject(v);
    if(any != NULL){
        cxStackPush(this, any);
    }
    CX_JSON_ARRAY_EACH_END(items, v)
}
Esempio n. 4
0
CX_SETTER_DEF(cxAtlas, layers)
{
    cxJson layers = cxJsonToArray(value);
    CX_JSON_ARRAY_EACH_BEG(layers, layer)
    {
        cxVec2f pos = cxVec2fv(0, 0);
        cxSize2f size = cxSize2fv(0, 0);
        cxBoxTex2f tex = cxBoxTex2fDefault();
        cxColor4f color = cxColor4fv(1, 1, 1, 1);
        pos = cxJsonVec2f(layer, "pos", pos);
        size = cxJsonSize2f(layer, "size", size);
        cxConstChars key = cxJsonConstChars(layer, "key");
        if(key != NULL){
            tex = cxTextureBox(this->cxSprite.texture, key);
        }else{
            tex = cxJsonBoxTex2f(layer, "coord", tex);
        }
        if(cxSize2Zero(size) && key != NULL){
            size = cxTextureSize(this->cxSprite.texture, key);
        }
        color = cxJsonColor4f(layer, "color", color);
        cxAtlasAppendBoxPoint(this, pos, size, tex, color);
    }