Exemple #1
0
Object * Database::load_obj(const wstring & name)
{

    int ret = 0;
    Object * obj = global->obj_mgr->find(name, ret);
    if (obj != NULL)
        return obj;
    if (!is_existent_in_json(name))
        return NULL;
    obj = new Object();
    
    obj->name = name;
    string key = wstring_to_string(name);
    ObjMapMap::iterator it = obj->attr_maps.begin();
    for (; it != obj->attr_maps.end(); it++){
        ObjMap * map = it->second;
        string map_name = it->first;
        Json::Value attr = root[key][map_name];
        int size = attr.size();
        for (int i = 0; i < size; i++){
            Object * other = find(attr[i].asString(), ret);
            if (other == NULL){
                ERR("find object error\n");
                continue;
            }
            map->insert(ObjMap::value_type(other->name, other));
        }
    }
    
    return obj;
}
	static ObjSet* get_framebuffer() {
		SDL_GLContext ctx = InfiCurrentContext();
		ObjMap::iterator f = framebuffers.find( ctx );
		if ( f == framebuffers.end() ) {
			ObjSet* narr = new ObjSet;
			framebuffers.insert( f, std::make_pair( ctx, narr ) );
			return narr;
		} else {
			return f->second;
		}
	}