List of usage examples for com.badlogic.gdx.assets AssetManager load
public synchronized <T> void load(String fileName, Class<T> type)
From source file:at.juggle.games.counting.SoundManager.java
License:Apache License
/** * Helper to load music in one line.//w w w .j av a 2 s. co m * @param assMan * @param path */ private void loadMusic(AssetManager assMan, String path) { assMan.load(path, Music.class); }
From source file:at.juggle.games.counting.SoundManager.java
License:Apache License
/** * Helper to load and register Event in one line. * @param assMan//w w w. j ava2 s . co m * @param path * @param event */ private void loadSound(AssetManager assMan, String path, String event) { assMan.load(path, Sound.class); event2sound.put(event, path); }
From source file:at.therefactory.jewelthief.Game.java
License:Open Source License
private void loadAssets() { AssetManager manager = JewelThief.getInstance().getAssetManager(); manager.load("audio/sounds/collect.ogg", Sound.class); manager.load("audio/sounds/coin.ogg", Sound.class); manager.load("audio/sounds/applause.ogg", Sound.class); manager.load("audio/sounds/one_blow_from_party_horn.ogg", Sound.class); manager.finishLoading();// www. j a va 2 s. c o m soundCollectJewel = manager.get("audio/sounds/collect.ogg", Sound.class); soundOuch = manager.get("audio/sounds/coin.ogg", Sound.class); soundApplause = manager.get("audio/sounds/applause.ogg", Sound.class); soundLose = manager.get("audio/sounds/one_blow_from_party_horn.ogg", Sound.class); }
From source file:at.therefactory.jewelthief.screens.LogoScreen.java
License:Open Source License
public LogoScreen(SpriteBatch batch, ShapeRenderer shapeRenderer, FitViewport viewport, OrthographicCamera camera) {//from w w w.ja v a2 s .co m this.batch = batch; this.shapeRenderer = shapeRenderer; this.viewport = viewport; this.camera = camera; spriteThere = new Sprite(new Texture("there.png")); spriteFactory = new Sprite(new Texture("factory.png")); spriteLibGdxLogo = new Sprite(new Texture("libgdx.png")); AssetManager am = JewelThief.getInstance().getAssetManager(); am.load("audio/sounds/keyboard.ogg", Sound.class); am.load("audio/sounds/keyboard_go_back.ogg", Sound.class); am.load("audio/sounds/re.ogg", Sound.class); am.load("audio/sounds/libgdx.ogg", Music.class); am.finishLoading(); soundTypeTheRefactory = am.get("audio/sounds/keyboard.ogg", Sound.class); soundGoBackOnKeyboard = am.get("audio/sounds/keyboard_go_back.ogg", Sound.class); soundTypeRe = am.get("audio/sounds/re.ogg", Sound.class); musicLibGdxJingle = am.get("audio/sounds/libgdx.ogg", Music.class); resetAnimation(); }
From source file:broken.shotgun.throwthemoon.actors.Background.java
License:Open Source License
public Background(AssetManager manager) { manager.setLoader(Texture.class, new TextureLoader(new InternalFileHandleResolver())); manager.load(TEXTURE_FILENAME, Texture.class); manager.finishLoading();/*from w w w . j a v a2 s . co m*/ texture = manager.get(TEXTURE_FILENAME); TextureRegion[] frames = TextureRegion.split(texture, FRAME_WIDTH, FRAME_HEIGHT)[0]; animation = new Animation(0.1f, frames[0], frames[1], frames[2]); animation.setPlayMode(PlayMode.LOOP); setWidth(FRAME_WIDTH); setHeight(FRAME_HEIGHT); background = new TiledDrawable(animation.getKeyFrame(0f)); }
From source file:broken.shotgun.throwthemoon.actors.Boss.java
License:Open Source License
public Boss(final AssetManager manager) { manager.setLoader(Texture.class, new TextureLoader(new InternalFileHandleResolver())); manager.setLoader(Sound.class, new SoundLoader(new InternalFileHandleResolver())); manager.load(TEXTURE_FILENAME, Texture.class); manager.load(SFX_HIT_FILENAME, Sound.class); manager.finishLoading();//from www . j a v a 2 s . c om texture = manager.get(TEXTURE_FILENAME); regions = TextureRegion.split(texture, FRAME_WIDTH, FRAME_HEIGHT)[0]; idle = new Animation(0.1f, regions[0], regions[1], regions[2]); idle.setPlayMode(Animation.PlayMode.LOOP); hitSfx = manager.get(SFX_HIT_FILENAME); currentFrame = idle.getKeyFrame(0.0f); setWidth(currentFrame.getRegionWidth()); setHeight(currentFrame.getRegionHeight()); setOrigin(getWidth() / 2, getHeight() / 2); collisionArea = new Rectangle(getX(), getY() + 80, (int) getWidth(), (int) getHeight() - 170); health = 50; raging = false; color = Color.WHITE; setColor(color); flipX = false; }
From source file:broken.shotgun.throwthemoon.actors.Enemy.java
License:Open Source License
public Enemy(final AssetManager manager) { manager.setLoader(Texture.class, new TextureLoader(new InternalFileHandleResolver())); manager.setLoader(Sound.class, new SoundLoader(new InternalFileHandleResolver())); manager.load(TEXTURE_FILENAME, Texture.class); manager.load(SFX_HIT_FILENAME, Sound.class); manager.finishLoading();/* ww w .java2 s .c om*/ texture = manager.get(TEXTURE_FILENAME); regions = TextureRegion.split(texture, FRAME_WIDTH, FRAME_HEIGHT)[0]; idle = new Animation(0.1f, regions[0], regions[1], regions[2]); idle.setPlayMode(Animation.PlayMode.LOOP); hitSfx = manager.get(SFX_HIT_FILENAME); currentFrame = idle.getKeyFrame(0.0f); setWidth(currentFrame.getRegionWidth()); setHeight(currentFrame.getRegionHeight()); setOrigin(getWidth() / 2, getHeight() / 2); collisionArea = new Rectangle(50, 0, (int) getWidth() - 100, (int) getHeight()); health = 5; }
From source file:broken.shotgun.throwthemoon.actors.Moon.java
License:Open Source License
public Moon(final AssetManager manager) { manager.setLoader(Texture.class, new TextureLoader(new InternalFileHandleResolver())); manager.setLoader(Sound.class, new SoundLoader(new InternalFileHandleResolver())); manager.load(TEXTURE_FILENAME, Texture.class); manager.load(SFX_MOON_CRASH_FILENAME, Sound.class); manager.finishLoading();/* www . j a v a 2 s . co m*/ texture = manager.get(TEXTURE_FILENAME); crashSfx = manager.get(SFX_MOON_CRASH_FILENAME); currentFrame = new TextureRegion(texture); setWidth(currentFrame.getRegionWidth()); setHeight(currentFrame.getRegionHeight()); setOrigin(getWidth() / 2, getHeight() / 2); reset(); }
From source file:broken.shotgun.throwthemoon.actors.MoonChain.java
License:Open Source License
public MoonChain(final AssetManager manager) { manager.setLoader(Texture.class, new TextureLoader(new InternalFileHandleResolver())); manager.setLoader(Sound.class, new SoundLoader(new InternalFileHandleResolver())); manager.load(TEXTURE_FILENAME, Texture.class); manager.load(SFX_CHAIN_PULL_FILENAME, Sound.class); manager.finishLoading();//w w w. j av a 2 s.c o m texture = manager.get(TEXTURE_FILENAME); texture.setWrap(Texture.TextureWrap.ClampToEdge, Texture.TextureWrap.Repeat); chainPullSfx = manager.get(SFX_CHAIN_PULL_FILENAME); setWidth(texture.getWidth()); setHeight(texture.getHeight() * TILE_COUNT); setOrigin(getWidth() / 2, 0); // Note: scale is not used in draw for the chain, this is a hack to make easier to put the chain down setScale(3f, 3f); collisionArea = new Rectangle(getX(), getY(), getWidth(), getHeight()); position = new Vector2(getX(), getY()); }
From source file:broken.shotgun.throwthemoon.actors.Player.java
License:Open Source License
public Player(final AssetManager manager) { manager.setLoader(Texture.class, new TextureLoader(new InternalFileHandleResolver())); manager.setLoader(Sound.class, new SoundLoader(new InternalFileHandleResolver())); manager.load(TEXTURE_FILENAME, Texture.class); manager.load(SFX_HIT_FILENAME, Sound.class); manager.load(SFX_DIE_FILENAME, Sound.class); manager.finishLoading();/*from ww w. j av a 2 s .c o m*/ texture = manager.get(TEXTURE_FILENAME); textureRegions = TextureRegion.split(texture, FRAME_WIDTH, FRAME_HEIGHT)[0]; idle = new Animation(0.1f, textureRegions[0], textureRegions[1], textureRegions[2]); idle.setPlayMode(Animation.PlayMode.LOOP); walk = new Animation(0.3f, textureRegions[3], textureRegions[4]); walk.setPlayMode(Animation.PlayMode.LOOP); attack = new Animation(0.3f, textureRegions[5], textureRegions[6], textureRegions[7]); attack.setPlayMode(Animation.PlayMode.NORMAL); hitSfx = manager.get(SFX_HIT_FILENAME); dieSfx = manager.get(SFX_DIE_FILENAME); setWidth(FRAME_WIDTH); setHeight(FRAME_HEIGHT); setOrigin(getWidth() / 2, getHeight() / 2); state = State.IDLE; currentFrame = idle.getKeyFrame(0.0f); moveTarget = new Vector2(-1, -1); position = new Vector2(getX(), getY()); velocity = new Vector2(0, 0); collisionArea = new Rectangle(getX() + 50, getY(), (int) getWidth() - 100, (int) getHeight()); attackArea = new Rectangle(0, 0, 0, 0); }