Beispiel #1
0
static cxInt cxEventSetTexture(lua_State *L)
{
    CX_LUA_DEF_THIS(cxView);
    cxConstChars url = NULL;
    cxConstChars viewid = NULL;
    cxBool uts = false;
    lua_getfield(L, 2, "src");
    if(lua_isstring(L, -1)){
        url = lua_tostring(L, -1);
    }
    lua_pop(L,1);
    lua_getfield(L, 2, "view");
    if(lua_isstring(L, -1)){
        viewid = lua_tostring(L, -1);
    }
    lua_pop(L,1);
    lua_getfield(L, 2, "useTexSize");
    if(lua_isboolean(L, -1)){
        uts = lua_toboolean(L, -1);
    }
    lua_pop(L,1);
    if(viewid == NULL){
        return 0;
    }
    cxView pview = cxViewRootGet(this, viewid);
    if(pview == NULL){
        return 0;
    }
    //use texture size
    cxSpriteSetTextureURL(pview, url, uts);
    return 0;
}
Beispiel #2
0
static cxInt cxSpriteLuaMake(lua_State *L)
{
    CX_LUA_CREATE_THIS(cxSprite);
    cxBool ust = cxLuaBoolValue(L, 2, true);
    cxBool cache = cxLuaBoolValue(L, 3, true);
    cxConstChars url = luaL_checkstring(L, 1);
    cxSpriteSetTextureURL(this, url, ust, cache);
    CX_LUA_RET_THIS(cxSprite);
}
Beispiel #3
0
static cxInt cxSpriteLuaSetTexture(lua_State *L)
{
    CX_LUA_DEF_THIS(cxSprite);
    cxBool ust = cxLuaBoolValue(L, 3, true);
    cxBool cache = cxLuaBoolValue(L, 4, true);
    cxConstChars url = luaL_checkstring(L, 2);
    cxSpriteSetTextureURL(this, url, ust, cache);
    return 0;
}
Beispiel #4
0
CX_SETTER_DEF(cxSprite, texture)
{
    cxConstChars texture = NULL;
    cxBool uts = true;
    if(cxJsonIsString(value)){
        texture = cxJsonToConstChars(value);
    }else if(cxJsonIsObject(value)){
        uts = cxJsonBool(value, "uts", uts);
        texture = cxJsonConstChars(value, "url");
    }
    CX_RETURN(texture == NULL);
    cxSpriteSetTextureURL(this, texture, uts);
}
Beispiel #5
0
void cxSpriteSetImage(cxAny pview,cxConstChars url)
{
    cxSpriteSetTextureURL(pview, url, false);
}
Beispiel #6
0
cxSprite cxSpriteCreateWithURL(cxConstChars url)
{
    cxSprite this = CX_CREATE(cxSprite);
    cxSpriteSetTextureURL(this, url, true);
    return this;
}
Beispiel #7
0
cxButton cxButtonCreate(cxConstChars url)
{
    cxButton this = CX_CREATE(cxButton);
    cxSpriteSetTextureURL(this, url, true);
    return this;
}