Android Open Source - crabox Asset Manager






From Project

Back to project page crabox.

License

The source code is released under:

Apache License

If you think the Android project crabox listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.costular.crabox.util;
//  ww  w .  ja v a2s.c  o m
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.NinePatch;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
import com.badlogic.gdx.utils.Disposable;
import com.costular.crabox.Cbx;

public class AssetManager implements Disposable{

  public final Sprite player;
  public final TextureRegion splash;
  
  public final TextureAtlas atlas;
  public final Skin skin;
  public final BitmapFont white;
  public final BitmapFont black;
  public final BitmapFont blue;
  
  //Sound
  public final Sound jump;
  public final Music music;
  
  public AssetManager() {

    white = new BitmapFont(Gdx.files.internal("fnt/white-bold.fnt"));
    black = new BitmapFont(Gdx.files.internal("fnt/black-bold.fnt"));
    blue = new BitmapFont(Gdx.files.internal("fnt/blue-bold.fnt"));
    
    white.getRegion().getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear);
    black.getRegion().getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear);
    blue.getRegion().getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear);
    
    jump = Gdx.audio.newSound(Gdx.files.internal("sound/jump.ogg"));
    music = Gdx.audio.newMusic(Gdx.files.internal("sound/music.mp3"));
    
    atlas = new TextureAtlas(Gdx.files.internal("img/crabox.atlas"));
    skin = new Skin();
    skin.addRegions(atlas);
    //Splash and buttons
    splash = new TextureRegion(new Texture(Gdx.files.internal("img/splash.png")), 800, 480);
    player = new Sprite(atlas.findRegion("cubo"));
  }
  
  @Override
  public void dispose() {
    player.getTexture().dispose(); 
    atlas.dispose();
    jump.dispose();
  }
  
  public Drawable getDrawable(String name) {
    return skin.getDrawable(name);
  }
  
  public NinePatch getNine(String name) {
    return skin.getPatch(name);
  }
    
}




Java Source Code List

com.costular.crabox.AddInterface.java
com.costular.crabox.Cbx.java
com.costular.crabox.Controller.java
com.costular.crabox.GameController.java
com.costular.crabox.GameState.java
com.costular.crabox.MainClass.java
com.costular.crabox.actors.Box.java
com.costular.crabox.actors.ContactBodies.java
com.costular.crabox.actors.DefaultBox.java
com.costular.crabox.actors.DefaultTriangle.java
com.costular.crabox.actors.Player.java
com.costular.crabox.actors.Score.java
com.costular.crabox.actors.ToggleButton.java
com.costular.crabox.android.AndroidLauncher.java
com.costular.crabox.android.Facebook.java
com.costular.crabox.android.Notification.java
com.costular.crabox.android.RequestAd.java
com.costular.crabox.screens.GameScreen.java
com.costular.crabox.screens.HUD.java
com.costular.crabox.screens.MenuScreen.java
com.costular.crabox.util.AssetManager.java
com.costular.crabox.util.AudioManager.java
com.costular.crabox.util.Box2DUtils.java
com.costular.crabox.util.FacebookRequest.java
com.costular.crabox.util.GeometryUtils.java
com.costular.crabox.util.NotificationRequest.java
com.costular.crabox.util.Preferences.java
com.costular.crabox.util.StageGenerator.java
com.costular.crabox.util.Utils.java