void ofxLayout::loadFromTemplate(string templateFolder, ofxJSONElement data){ loadDataFromFile(templateFolder+"/layout-data.json"); loadData(data); loadOfmlFromFile(templateFolder+"/index.ofml"); loadOssFromFile(templateFolder+"/styles.oss"); loadAnimationsFromFile(templateFolder+"/animations.json"); }
void ofxLayout::loadFromFile(string filename){ ofxJSONElement layoutConfig; bool layoutParsingSuccessful = layoutConfig.open(filename); if(layoutParsingSuccessful){ loadDataFromFile(filename); loadOfmlFromFile(layoutConfig["template"].asString()+"/index.ofml"); loadOssFromFile(layoutConfig["template"].asString()+"/styles.oss"); loadAnimationsFromFile(layoutConfig["template"].asString()+"/animations.json"); } else{ ofLogError("ofxLayout::loadFromFile","Unable to parse config file "+filename+"."); } }
void AmmoView::loadRessources() { if(textures.size() > 0) return; /* === TEXTURES === */ Texture* tex; /* BULLET */ tex = new Texture(); tex->loadFromFile("res/tex/ammo/bullet.png"); textures.push_back(tex); textures.push_back(NULL); textures.push_back(NULL); /* FLAME */ tex = new Texture(); tex->loadFromFile("res/tex/ammo/flame.png"); textures.push_back(tex); textures.push_back(NULL); /* GRENADE */ tex = new Texture(); tex->loadFromFile("res/tex/ammo/grenade.png"); textures.push_back(tex); /* === ANIMATIONS ===*/ animations_list[BULLET] = loadAnimationsFromFile("res/xml/ammo/bullet.xml"); animations_list[FLAME] = loadAnimationsFromFile("res/xml/ammo/flame.xml"); animations_list[GRENADE] = loadAnimationsFromFile("res/xml/ammo/grenade.xml"); /* === SONS === */ /* BULLET */ SoundBuffer* buffer = new SoundBuffer(); buffer->loadFromFile("res/snd/ammo/bullet.wav"); Sound* s = new Sound(); s->setBuffer(*buffer); sounds.push_back(s); /* HEAVY_BULLET */ buffer = new SoundBuffer(); buffer->loadFromFile("res/snd/ammo/shotgun.wav"); s = new Sound(); s->setBuffer(*buffer); sounds.push_back(s); /* LIGHT_BULLET */ sounds.push_back(NULL); /* FLAME */ buffer = new SoundBuffer(); buffer->loadFromFile("res/snd/ammo/flame.wav"); s = new Sound(); s->setBuffer(*buffer); sounds.push_back(s); /* ROCKET */ sounds.push_back(NULL); /* GRENADE */ buffer = new SoundBuffer(); buffer->loadFromFile("res/snd/ammo/grenade.wav"); s = new Sound(); s->setBuffer(*buffer); sounds.push_back(s); }
void EnemyView::loadRessources(TypeEnemy t) { if(textures[t] != NULL) return; /* REBEL */ if(t == REBEL) { // TEXTURE Texture* tex = new Texture(); tex->loadFromFile("res/tex/enemy/rebel.png"); textures[REBEL] = tex; // ANIMATION animations_list[REBEL] = loadAnimationsFromFile("res/xml/enemy/rebel.xml"); // SOUNDS SoundBuffer* buffer; buffer = new SoundBuffer; buffer->loadFromFile("res/snd/enemy/rebel/death1.wav"); // DEATH sounds_buffers[REBEL].push_back(buffer); buffer = new SoundBuffer; buffer->loadFromFile("res/snd/enemy/rebel/death2.wav"); // DEATH2 sounds_buffers[REBEL].push_back(buffer); buffer = new SoundBuffer; buffer->loadFromFile("res/snd/enemy/rebel/death3.wav"); // DEATH3 sounds_buffers[REBEL].push_back(buffer); } /* BOWSER */ else if(t == BOWSER) { // TEXTURE Texture* tex = new Texture(); tex->loadFromFile("res/tex/enemy/bowser.png"); textures[BOWSER] = tex; // ANIMATION animations_list[BOWSER] = loadAnimationsFromFile("res/xml/enemy/bowser.xml"); // SOUNDS SoundBuffer* buffer; buffer = new SoundBuffer; buffer->loadFromFile("res/snd/enemy/bowser/death.wav"); // DEATH sounds_buffers[BOWSER].push_back(buffer); buffer = new SoundBuffer; buffer->loadFromFile("res/snd/enemy/bowser/death2.wav"); // DEATH2 sounds_buffers[BOWSER].push_back(buffer); } /* FLYING */ else if(t == FLYING) { // TEXTURE Texture* tex = new Texture(); tex->loadFromFile("res/tex/enemy/flying.png"); textures[FLYING] = tex; // ANIMATION animations_list[FLYING] = loadAnimationsFromFile("res/xml/enemy/flying.xml"); // SOUNDS SoundBuffer* buffer; buffer = new SoundBuffer; buffer->loadFromFile("res/snd/enemy/flying/death.wav"); // DEATH sounds_buffers[FLYING].push_back(buffer); } }