static void cxLoadingArrive(cxEvent *event) { cxLoading this = cxActionView(event->sender); CX_EVENT_FIRE(this, onLoading); cxTimer timer = cxViewAppendTimer(this, 1.0f, 1); CX_EVENT_QUICK(timer->onArrive, cxFinishedArrive); }
static cxInt cxViewLuaCreateTimer(lua_State *L) { CX_LUA_DEF_THIS(cxView); cxFloat time = luaL_checknumber(L, 2); cxInt repeat = luaL_checkinteger(L, 3); cxAny timer = cxViewAppendTimer(this, time, repeat); CX_LUA_PUSH_OBJECT(timer); return 1; }
void cxLoaingFinished(cxAny pview) { cxLoading this = pview; this->isLoading = true; } CX_OBJECT_INIT(cxLoading, cxView) { this->isLoading = false; CX_EVENT_QUICK(this->super.onUpdate, cxLoadingOnUpdate); CX_METHOD_OVERRIDE(this->super.Touch, cxLoadingTouch); } CX_OBJECT_FREE(cxLoading, cxView) { CX_EVENT_RELEASE(this->onStart); CX_EVENT_RELEASE(this->onFinished); CX_EVENT_RELEASE(this->onLoading); } CX_OBJECT_TERM(cxLoading, cxView) void cxLoadingStart(cxLoading this) { cxEngine engine = cxEngineInstance(); CX_EVENT_FIRE(this, onStart); cxTimer timer = cxViewAppendTimer(this, 1.0f, 1); CX_EVENT_QUICK(timer->onArrive, cxLoadingArrive); cxViewAppend(engine->window, this); }