Esempio n. 1
0
cxSprite cxSpriteCreateWithFile(cxConstChars file,cxConstChars key)
{
    cxSprite this = CX_CREATE(cxSprite);
    cxTexture texture = cxTextureFactoryLoadFile(file);
    cxSpriteSetTexture(this, texture);
    cxSpriteSetTextureKey(this, key, true);
    return this;
}
Esempio n. 2
0
void cxSpriteSetTextureURL(cxAny pview,cxConstChars url,cxBool useTexSize)
{
    CX_RETURN(url == NULL);
    cxSprite this = pview;
    cxUrlPath path = cxUrlPathParse(url);
    CX_RETURN(path == NULL);
    cxTexture texture = cxTextureFactoryLoadFile(path->path);
    CX_ASSERT(texture != NULL, "texture load failed %s",path->path);
    cxSpriteSetTexture(this, texture);
    //use texture size
    cxBool uts = useTexSize;
    if(path->count > 1){
        cxSpriteSetTextureKey(this, path->key, uts);
    }else if(uts){
        cxViewSetSize(this, texture->size);
    }
}