package ast;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
import org.newdawn.slick.opengl.Texture;
import ast.ui.Font;
/**
* Loads and stores assets used
* @author Ben
*
*/
public class AssetStore {
private static HashMap<String, Model> models = new HashMap<String, Model>();
private static HashMap<String, Texture> textures = new HashMap<String, Texture>();
private static Font font;
/**
* Load assets
*/
public static void load(){
try {
models.put("Player", ResLoader.loadOBJ(new File("res/model/ship.obj")));
getModel("Player").init();//0.05f);
models.put("Asteroid", ResLoader.loadOBJ(new File("res/model/roca.obj")));
getModel("Asteroid").init();//0.2f);
textures.put("Background", ResLoader.loadTexture("res/img/background.jpg"));
textures.put("Particle", ResLoader.loadTexture("/res/img/SmokeParticle.png"));
textures.put("Font", ResLoader.loadTexture("res/img/font.png"));
File fontMap = new File("res/img/fontMap");
font = new Font(getTexture("Font"),fontMap);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* Get Model
* @param key - Name of model
* @return model
*/
public static Model getModel(String key){
return models.get(key);
}
/**
* Get Texture
* @param key - Name of Texture
* @return Texture
*/
public static Texture getTexture(String key){
return textures.get(key);
}
/**
* Get Font
* @return Font
*/
public static Font getFont(){
return font;
}
}