Example #1
0
void cxActionReadAttr(cxReaderAttrInfo *info)
{
    cxAction this = info->object;
    //
    cxActionSetStepHide(this, cxXMLReadBoolAttr(info, "cxAction.stepHide", this->stepHide));
    //delay
    cxActionSetDelay(this, cxXMLReadFloatAttr(info, "cxAction.delay", this->delay));
    //time
    cxActionSetDuration(this, cxXMLReadFloatAttr(info, "cxAction.time", this->duration));
    //init time
    cxActionSetDurationInit(this, cxXMLReadFloatAttr(info, "cxAction.initTime", this->durationInit));
    //curve
    cxConstChars scurve = cxXMLAttr(info->reader, "cxAction.curve");
    cxCurveItem curve = cxCurveGet(scurve);
    if(curve != NULL){
        CX_METHOD_OVERRIDE(this->Curve, curve->func);
    }
    //
    cxActionSetSplit(this, cxXMLReadIntAttr(info, "cxAction.split", this->split));
    //
    cxActionSetSpeed(this, cxXMLReadFloatAttr(info, "cxAction.speed", this->speed));
    //actionId
    cxActionSetId(this, cxXMLReadIntAttr(info, "cxAction.id", this->actionId));
    //forever
    if(cxXMLReadBoolAttr(info, "cxAction.forever", false)){
        CX_METHOD_OVERRIDE(this->Exit, cxActionForever);
    }
    //assist
    this->assist = cxXMLReadAssist4fAttr(info, "cxAction.assist", this->assist);
    //event
    cxXMLAppendEvent(info, this, cxAction, onStart);
    cxXMLAppendEvent(info, this, cxAction, onStop);
    cxXMLAppendEvent(info, this, cxAction, onSplit);
    cxXMLAppendEvent(info, this, cxAction, onStep);
}
Example #2
0
static void cxJumpReadAttr(cxReaderAttrInfo *info)
{
    cxActionReadAttr(info);
    cxJump this = info->object;
    this->position = cxXMLReadVec2fAttr(info, "cxJump.position", this->position);
    this->height = cxXMLReadFloatAttr(info, "cxJump.height", this->height);
    this->jumps  = cxXMLReadIntAttr(info, "cxJump.jumps", this->jumps);
}
Example #3
0
static cxBool cxTimerXMLReadAttr(cxAny xmlAction,cxAny mAction, xmlTextReaderPtr reader)
{
    cxActionXMLReadAttr(xmlAction, mAction, reader);
    cxActionXML xml = xmlAction;
    cxTimer this = mAction;
    this->repeat = cxXMLReadIntAttr(reader, "cxTimer.repeat", this->repeat);
    cxXMLAppendEvent(xml->events, this, cxTimer, onArrive);
    return true;
}
Example #4
0
static void cxViewRootReadRectToView(cxReaderAttrInfo *info)
{
    cxView this = info->object;
    cxVec2f pos = cxXMLReadVec2fAttr(info, "cxView.position", this->position);
    pos.x = cxXMLReadFloatAttr(info, "cxView.x", pos.x);
    pos.y= cxXMLReadFloatAttr(info, "cxView.y", pos.y);
    cxViewSetPos(this, pos);
    cxViewSetOrder(this, cxXMLReadIntAttr(info, "cxView.z", this->zorder));
    cxSize2f size = cxXMLReadSize2fAttr(info, "cxView.size", this->size);
    size.w = cxXMLReadFloatAttr(info, "cxView.w", size.w);
    size.h = cxXMLReadFloatAttr(info, "cxView.h", size.h);
    cxViewSetSize(this, size);
}
Example #5
0
static void cxChipmunkGetAttr(cxReaderAttrInfo *info,cxChipmunkAttr *attr)
{
    cxChipmunkAttrInit(attr);
    attr->shape = cxXMLReadIntAttr(info, "cxChipmunk.shape", cxChipmunkShapeBox);
    attr->cp = cxXMLReadVec2fAttr(info, "cxChipmunk.center", cxVec2fv(0, 0));
    attr->isStatic = cxXMLReadBoolAttr(info, "cxChipmunk.static", attr->isStatic);
    attr->m = cxXMLReadFloatAttr(info, "cxChipmunk.m", attr->m);
    attr->e = cxXMLReadFloatAttr(info, "cxChipmunk.e", attr->e);
    attr->u = cxXMLReadFloatAttr(info, "cxChipmunk.u", attr->u);
    attr->group = cxXMLReadUIntAttr(info, "cxChipmunk.group", CP_NO_GROUP);
    attr->layer = cxXMLReadUIntAttr(info, "cxChipmunk.layer", CP_ALL_LAYERS);
    attr->ctype = cxXMLReadUIntAttr(info, "cxChipmunk.ctype", 0);
}