Exemple #1
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);
}
Exemple #2
0
void cxActionReadAttr(cxReaderAttrInfo *info)
{
    cxAction this = info->object;
    //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, cxXMLReadUIntAttr(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);
}