- //////////This is the Asset Manger class which is called first off when you launch your project.
- public class Assets implements Screen{
- private float WIDTH= 800;
- private float HEIGHT = 480;
- public static EggWrap game;
- public static AssetManager manager;
- public static SpriteBatch batch;
- public static OrthographicCamera cam;
- BitmapFont font;
- public static Texture bg;
- public static TextureRegion bgR;
- String loading;
- float progress;
- float prog;
- public Assets(EggWrap game){
- font = new BitmapFont(Gdx.files.internal("font.fnt"), Gdx.files.internal("font.png"),false);
- font.getRegion().getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear);
- Assets.game = game;
- manager = new AssetManager();
- cam = new OrthographicCamera(WIDTH,HEIGHT);
- cam.position.set(WIDTH / 2, HEIGHT / 2, 0);
- batch = new SpriteBatch();
- bg = new Texture(Gdx.files.internal("splash.png"));
- bg.setFilter(TextureFilter.Linear, TextureFilter.Linear);
- bgR = new TextureRegion(bg,0,0,800,480);
- load();
- }
- public static void load(){
- manager.load("01.jpg", Texture.class);
- manager.load("02.jpg", Texture.class);
- manager.load("03.jpg", Texture.class);
- manager.load("04.jpg", Texture.class);
- manager.load("05.jpg", Texture.class);
- manager.load("06.jpg", Texture.class);
- manager.load("07.jpg", Texture.class);
- manager.load("08.jpg", Texture.class);
- manager.load("09.jpg", Texture.class);
- manager.load("10.jpg", Texture.class);
- manager.load("11.jpg", Texture.class);
- manager.load("12.jpg", Texture.class);
- manager.load("menu.jpg", Texture.class);
- manager.load("ingredients.jpg", Texture.class);
- manager.load("utils.jpg", Texture.class);
- manager.load("menuNav.png", Texture.class);
- manager.load("nav.png", Texture.class);
- }
- public static void unload(){
- }
- public void render(float delta) {
- Gdx.gl.glClearColor(1f, 1f, 1f, 1f);
- Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
- cam.update();
- batch.setProjectionMatrix(cam.combined);
- batch.begin();
- batch.draw(bgR, 0, 0);
- progress = manager.getProgress();
- loading = new String( "loading" + progress);
- boolean result = manager.update();
- if(result){
- game.setScreen(new Menu(game));
- System.out.println("assets loaded - setting new screen");
- }
- font.draw(batch, "Loading " +(int) (progress *100) , 800 / 2 - 40, 30);
- // System.out.println("" +(int) (progress *100) );
- batch.end();
- }
- @Override
- public void resize(int width, int height) {
- }
- @Override
- public void show() {
- }
- @Override
- public void hide() {
- }
- @Override
- public void pause() {
- }
- @Override
- public void resume() {
- }
- @Override
- public void dispose() {
- }
- }
SHARE
TWEET
Untitled
a guest
Sep 10th, 2014
199
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
