示例#1
0
文件: texture.c 项目: AsamQi/ejoy2d
void 
texture_clearall() {
	int i;
	for (i=0;i<POOL.count;i++) {
		texture_unload(i);
	}
}
示例#2
0
void texture_cache_unload(struct texture_cache* self, const char* key)
{
    struct texture* tex = hashmapGet(self->cache, (void*)key);
    if (!tex) {
        hashmapPut(self->cache, (void*)key, NULL);
        texture_unload(tex);
    } else {
        fprintf(stderr, "texture %s has already been removed", key);
    }
}
示例#3
0
文件: lsprite.c 项目: lvshaco/ejoy2d
static int
ldeldfont(lua_State *L) {
	struct dfont *df = get_dfont(L);
	if (!df) {
		return luaL_error(L, "invalid dfont table");
	}

	lua_getfield(L, 1, "texture");
	int tid = luaL_checkinteger(L, -1);
	lua_pop(L, 1);
	
	texture_unload(tid);
	
	return 0;
}
示例#4
0
void sgn_geom_draw(struct sgn_base *_self, struct scene *scene) {
	tzm4 tmp;
	T *self = (T *)_self;
	assert(sgn_isgeom(self) && "node is not a sgn_geom, fix vtbl.");

	tzm4 *cam  = sgn_base_to(scene->active_cam);
	/* from world to eye */
	tzm4_mulm(&tmp, cam, sgn_base_to(_self));
	/* apply the localT transformation. */
	tzm4_mulm(&tmp, &tmp,
			sgn_geom_localT(self));
	/* TODO: fix bull crap */
	if (self->mat) material_load  (self->mat);
	if (self->tex) texture_load   (self->tex);
	geometry_draw(self->geom, &tmp);
	if (self->tex) texture_unload (self->tex);
	if (self->mat) material_unload(self->mat);

	sgn_base_draw(&self->base, scene);
}
示例#5
0
void
release_screenshot(int tex_id) {
	if (tex_id) {
		texture_unload(tex_id);
	}
}