Ejemplo n.º 1
0
CX_OBJECT_INIT(cxSprite, cxView)
{
    this->texCoord = cxBoxTex2fDefault();
    cxSpriteSetBlendFactor(this, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    CX_EVENT_APPEND(this->cxView.onDirty, cxSpriteDirtyEvent);
    CX_METHOD_SET(this->cxView.Draw, cxSpriteDraw);
    cxSpriteSetShader(this, cxShaderDefaultKey);
}
Ejemplo n.º 2
0
CX_OBJECT_INIT(cxSprite, cxView)
{
    this->texCoord = cxBoxTex2fDefault();
    cxSpriteSetBlendFactor(this, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    CX_EVENT_QUICK(this->super.onDirty, cxSpriteDirtyEvent);
    CX_METHOD_OVERRIDE(this->super.Draw, cxSpriteDraw);
    cxSpriteSetShader(this, cxShaderDefaultKey);
    cxObjectSetReadAttrFunc(this, cxSpriteReadAttr);
}
Ejemplo n.º 3
0
//texture="res/a.xml?green.png"
void cxSpriteReadAttr(cxReaderAttrInfo *info)
{
    cxSprite this = info->object;
    //set texture
    cxTextureAttr texAttr = cxXMLReadTextureAttr(info, "cxSprite.texture");
    cxSpriteSetTextureAttr(this, texAttr);
    //flipx flipy
    cxSpriteSetFlipX(this, cxXMLReadBoolAttr(info, "cxSprite.flipX", this->isFlipX));
    cxSpriteSetFlipY(this, cxXMLReadBoolAttr(info, "cxSprite.flipY", this->isFlipY));
    //shader
    cxString shader = cxXMLReadStringAttr(info, "cxSprite.shader");
    cxSpriteSetShader(this, cxStringBody(shader));
    //
    cxViewReadAttr(info);
}