package com.niw.slappybug.manager;
import org.andengine.engine.Engine;
import org.andengine.engine.camera.Camera;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
import org.andengine.opengl.texture.region.ITextureRegion;
import org.andengine.opengl.vbo.VertexBufferObjectManager;
import com.niw.slappybug.Consts;
import com.niw.slappybug.GameActivity;
/**
* @author Mateusz Mysliwiec
* @author www.matim-dev.com
* @version 1.0
*/
public class ResourcesManager
{
//---------------------------------------------
// VARIABLES
//---------------------------------------------
private static final ResourcesManager INSTANCE = new ResourcesManager();
public Engine engine;
public GameActivity activity;
public Camera camera;
public VertexBufferObjectManager vbom;
public ITextureRegion splash_region;
private BitmapTextureAtlas splashTextureAtlas;
//---------------------------------------------
// TEXTURES & TEXTURE REGIONS
//---------------------------------------------
//---------------------------------------------
// CLASS LOGIC
//---------------------------------------------
public void loadMenuResources()
{
loadMenuGraphics();
loadMenuAudio();
}
public void loadGameResources()
{
loadGameGraphics();
loadGameFonts();
loadGameAudio();
}
private void loadMenuGraphics()
{
}
private void loadMenuAudio()
{
}
private void loadGameGraphics()
{
}
private void loadGameFonts()
{
}
private void loadGameAudio()
{
}
public void loadSplashScreen()
{
BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
splashTextureAtlas = new BitmapTextureAtlas(activity.getTextureManager(), Consts.SCREEN_HEIGHT, Consts.SCREEN_WIDTH);
splash_region = BitmapTextureAtlasTextureRegionFactory.createFromAsset(splashTextureAtlas, activity, "background.png", 0, 0);
}
public void unloadSplashScreen()
{
splashTextureAtlas.unload();
splash_region = null;
}
/**
* @param engine
* @param activity
* @param camera
* @param vbom
* <br><br>
* We use this method at beginning of game loading, to prepare Resources Manager properly,
* setting all needed parameters, so we can latter access them from different classes (eg. scenes)
*/
public static void prepareManager(Engine engine, GameActivity activity, Camera camera, VertexBufferObjectManager vbom)
{
getInstance().engine = engine;
getInstance().activity = activity;
getInstance().camera = camera;
getInstance().vbom = vbom;
}
//---------------------------------------------
// GETTERS AND SETTERS
//---------------------------------------------
public static ResourcesManager getInstance()
{
return INSTANCE;
}
}