當前位置: 首頁>>代碼示例>>Java>>正文


Java AssetManager.get方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.assets.AssetManager.get方法的典型用法代碼示例。如果您正苦於以下問題:Java AssetManager.get方法的具體用法?Java AssetManager.get怎麽用?Java AssetManager.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.assets.AssetManager的用法示例。


在下文中一共展示了AssetManager.get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: Sounds

import com.badlogic.gdx.assets.AssetManager; //導入方法依賴的package包/類
/**
 * Sounds constructor.
 * Plays the background music and initializes the game dependent sounds.
 *
 * @param assetManager Place where the sounds and musics are gotten from.
 */
public Sounds(AssetManager assetManager) {
    this.assetManager = assetManager;
    loadSounds();

    Music music = assetManager.get("music/Artofescapism_-_Three_Star_Sky.mp3");
    music.setVolume(0.5f);
    music.setLooping(true);
    music.play();

    //Initializing the game different sounds
    powerup = assetManager.get("music/item.mp3");
    jump = assetManager.get("music/jump.wav");
    lost = assetManager.get("music/lost.wav");
    won = assetManager.get("music/won.wav");
    water = assetManager.get("music/water.wav");
}
 
開發者ID:AndreFCruz,項目名稱:feup-lpoo-armadillo,代碼行數:23,代碼來源:Sounds.java

示例2: onInit

import com.badlogic.gdx.assets.AssetManager; //導入方法依賴的package包/類
@Override
protected void onInit(ScreenBasedGame game, AssetManager assetManager) {
    // load assets
    assetManager.load(MUSIC_PATH, Music.class);
    assetManager.load(BACKGROUND_IMAGE_PATH, Texture.class);
    assetManager.finishLoadingAsset(MUSIC_PATH);
    assetManager.finishLoadingAsset(BACKGROUND_IMAGE_PATH);

    // get assets
    this.music = assetManager.get(MUSIC_PATH, Music.class);
    this.bgTexture = assetManager.get(BACKGROUND_IMAGE_PATH, Texture.class);

    // generate fonts
    this.titleFont = BitmapFontFactory.createFont("./data/font/spartakus/SparTakus.ttf", 48, Color.WHITE,
            Color.BLUE, 3);
    // this.font2 =
    // BitmapFontFactory.createFont("./data/font/spartakus/SparTakus.ttf",
    // 48, Color.RED, Color.WHITE, 3);
    this.font1 = BitmapFontFactory.createFont("./data/font/arial/arial.ttf", 18, Color.WHITE);
    this.font2 = BitmapFontFactory.createFont("./data/font/arial/arial-bold.ttf", 24, Color.WHITE, Color.RED, 3);

    // generate credits text array
    try {
        this.generateCreditLines();
    } catch (IOException e) {
        e.printStackTrace();

        // TODO: remove this line and handle exception with exception window
        System.exit(0);
    }

    Gdx.input.setInputProcessor(null);
}
 
開發者ID:opensourcegamedev,項目名稱:SpaceChaos,代碼行數:34,代碼來源:CreditsScreen.java

示例3: onInit

import com.badlogic.gdx.assets.AssetManager; //導入方法依賴的package包/類
@Override
protected void onInit(ScreenBasedGame game, AssetManager assetManager) {
    // generate fonts
    this.font1 = BitmapFontFactory.createFont("./data/font/spartakus/SparTakus.ttf", 48, Color.WHITE, Color.BLUE,
            3);
    this.font2 = BitmapFontFactory.createFont("./data/font/spartakus/SparTakus.ttf", 48, Color.RED, Color.WHITE, 3);

    // load & get assets
    assetManager.load(TORPEDO_IMAGE_PATH, Texture.class);
    assetManager.finishLoadingAsset(TORPEDO_IMAGE_PATH);
    this.torpedoTexture = assetManager.get(TORPEDO_IMAGE_PATH, Texture.class);

    // create new Head-Up-Display
    this.hud = new HUD();
    this.filledBar = new FilledBar(this.font1);
    this.filledBar.setPosition(game.getViewportWidth() - 400, game.getViewportHeight() - 85);
    this.filledBar.setDimension(155, 35);
    this.hud.addWidget(this.filledBar);

    this.shapeRenderer = new ShapeRenderer();
}
 
開發者ID:opensourcegamedev,項目名稱:SpaceChaos,代碼行數:22,代碼來源:HUDOverlayScreen.java

示例4: DeathScreen

import com.badlogic.gdx.assets.AssetManager; //導入方法依賴的package包/類
public DeathScreen(Polymorph polymorph,int playerscore) {
    AssetManager assetManager = polymorph.getAssetManager();
    TextureAtlas textureAtlas = assetManager.get(Polymorph.MASTER_PATH, TextureAtlas.class);
    this.polymorph = polymorph;
    score=playerscore;

    DeathScreenMusic = assetManager.get(Polymorph.MAIN_MENU_MUSIC_PATH);
    DeathScreenMusic.setLooping(true);

    background = textureAtlas.findRegion("mainmenu"); //TODO make a unique background for the death screen
    screenSize = new Dimension(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

    camera = new OrthographicCamera();
    camera.setToOrtho(false, screenSize.width, screenSize.height); //change this
    batch=new SpriteBatch();
    batch.setProjectionMatrix(camera.combined);

    stage = new Stage();
    stage.clear();
    font = new BitmapFont(false);

    textureAtlas = assetManager.get(Polymorph.MASTER_PATH, TextureAtlas.class);
    initButtons(score,textureAtlas);
    Gdx.input.setInputProcessor(stage);

}
 
開發者ID:DurianHLN,項目名稱:Polymorph,代碼行數:27,代碼來源:DeathScreen.java

示例5: CutsceneStoneAge

import com.badlogic.gdx.assets.AssetManager; //導入方法依賴的package包/類
public CutsceneStoneAge(MyGdxGame myGdxGame) {
	this.myGdxGame = myGdxGame;
	batch = myGdxGame.batch;
	sr = myGdxGame.sr;
	viewport = myGdxGame.viewport;
	camera = myGdxGame.camera;
	font = myGdxGame.font;

	particles = new Particles();

	bg = new Sprite(new Texture("sprites/orange.png"));
	girl = new Sprite(new Texture("sprites/girl.png"));
	stone = new Sprite(new Texture("sprites/stein_angemalt.png"));
	hominideSitzend = new Sprite(new Texture("sprites/hominide_sitzend.png"));
	hominideDuckend = new Sprite(new Texture("sprites/hominide_duckend.png"));
	hominideStehend = new Sprite(new Texture("sprites/hominide_stehend.png"));

	assetManager = new AssetManager();
	assetManager.load("music/tusch.mp3", Sound.class);
	assetManager.load("music/5_steinzeit.mp3", Music.class);

	assetManager.finishLoading();

	tusch = assetManager.get("music/tusch.mp3", Sound.class);
	musicStoneAge = assetManager.get("music/5_steinzeit.mp3", Music.class);
}
 
開發者ID:cdetamble,項目名稱:nomoore,代碼行數:27,代碼來源:CutsceneStoneAge.java

示例6: LogoScreen

import com.badlogic.gdx.assets.AssetManager; //導入方法依賴的package包/類
public LogoScreen(SpriteBatch batch, ShapeRenderer shapeRenderer, FitViewport viewport, OrthographicCamera camera) {
    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();
}
 
開發者ID:cdetamble,項目名稱:jewelthief,代碼行數:25,代碼來源:LogoScreen.java

示例7: create

import com.badlogic.gdx.assets.AssetManager; //導入方法依賴的package包/類
/** Инициализация и загрузка ресурсов */
@Override
public void create () {
	// Размеры экрана
	scrHalfWidth = Gdx.graphics.getWidth() / 2;
	scrHeight = Gdx.graphics.getHeight();

	// Загрузка модели из файла
	modelBatch = new ModelBatch();
	assets = new  AssetManager();
	assets.load("room.g3db", Model.class);
	assets.finishLoading();
	Model roomModel = assets.get("room.g3db");
	roomInstance = new ModelInstance(roomModel);

	// Создание камеры (fov, parallax, near, far) и установка позиции
	vrCamera = new VRCamera(90, 0.4f, 0.1f, 30f);
	vrCamera.setPosition(-1.7f, 3f, 3f);

	// Разрешаем коррекцию дрифта при помощи компаса
	vrSensorManager.useDriftCorrection(true);
}
 
開發者ID:SinuXVR,項目名稱:GdxVR-Sample-1,代碼行數:23,代碼來源:GdxVR.java

示例8: AssetsMainMenu

import com.badlogic.gdx.assets.AssetManager; //導入方法依賴的package包/類
public AssetsMainMenu() {
    manager = new AssetManager();
    manager.load(Presets.TEXTURE_UI + "background.png", Texture.class);
    manager.load(Presets.TEXTURE_UI + "icon.png", Texture.class);     
    manager.load(Presets.SOUNDS + "wall_hit.ogg", Sound.class);
    manager.load(Presets.SOUNDS + "bullet_dead.ogg", Sound.class);
    manager.load(Presets.TEXTURE_UI + DEFAULT_FONT, BitmapFont.class);
    manager.finishLoading();

    mainMenuTexture = manager.get(Presets.TEXTURE_UI + "background.png");
    selectionIcon = new Sprite((Texture) manager.get(Presets.TEXTURE_UI
            + "icon.png"));     

    defaultFont = manager.get(Presets.TEXTURE_UI + DEFAULT_FONT);
    selectionSound = manager.get(Presets.SOUNDS + "bullet_dead.ogg");
    selectSound = manager.get(Presets.SOUNDS + "wall_hit.ogg");
    postLoading();
}
 
開發者ID:jh62,項目名稱:Battle-City-Multiplayer,代碼行數:19,代碼來源:AssetsMainMenu.java

示例9: loadAsyncImages

import com.badlogic.gdx.assets.AssetManager; //導入方法依賴的package包/類
protected void loadAsyncImages()
{
    // Check if we need to load level icons and if they are loaded show them.
    if (!this.asyncImages.isEmpty())
    {
        AssetManager assMan = AssMan.getAssMan();

        ArrayList<String> texturePaths =
            new ArrayList<>(this.asyncImages.keySet());
        for (String texturePath : texturePaths)
        {
            if (assMan.update()
                || assMan.isLoaded(texturePath))
            {
                Texture texture = assMan.get(texturePath);
                texture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
                this.asyncImages.get(texturePath)
                    .setDrawable(new TextureRegionDrawable(new TextureRegion(texture)));

                this.asyncImages.remove(texturePath);
            }
        }
    }
}
 
開發者ID:overengineering,項目名稱:space-travels-3,代碼行數:25,代碼來源:Screen.java

示例10: loadAsync

import com.badlogic.gdx.assets.AssetManager; //導入方法依賴的package包/類
@Override public void loadAsync(AssetManager manager, String fileName, FileHandle file, ThesaurusLoader.ThesaurusParameter parameter) {
    Constructor constructor = new Constructor(ThesaurusData.class);
    Yaml yaml = new Yaml(constructor);
    ObjectMap<String, ThesaurusData> data = new ObjectMap<String, ThesaurusData>();
    for (Object o : yaml.loadAll(resolve(fileName).read())) {
        ThesaurusData description = (ThesaurusData) o;
        data.put(description.key, description);
    }
    if (parameter != null && parameter.other.length > 0) {
        for (String depName : parameter.other) {
            Thesaurus dep = manager.get(depName);
            data.putAll(dep.data);
        }
    }
    thesaurus = new Thesaurus(data);
}
 
開發者ID:ratrecommends,項目名稱:dice-heroes,代碼行數:17,代碼來源:ThesaurusLoader.java

示例11: init

import com.badlogic.gdx.assets.AssetManager; //導入方法依賴的package包/類
public void init(AssetManager assetManager) {
    this.assetManager = assetManager;
    assetManager.setErrorListener(this);
    assetManager.load(TEXTURE_ATLAS_OBJECTS, TextureAtlas.class);
    // load sounds
    assetManager.load("sounds/jump.wav", Sound.class);
    assetManager.load("sounds/jump_with_feather.wav", Sound.class);
    assetManager.load("sounds/pickup_coin.wav", Sound.class);
    assetManager.load("sounds/pickup_feather.wav", Sound.class);
    assetManager.load("sounds/live_lost.wav", Sound.class);
    // load music
    assetManager.load("music/hair.ogg", Music.class);
    assetManager.finishLoading();

    Gdx.app.debug(TAG, "# of assets loaded: " + assetManager.getAssetNames().size);
    for (String a : assetManager.getAssetNames()) {
        Gdx.app.debug(TAG, "asset: " + a);
    }

    TextureAtlas atlas = assetManager.get(TEXTURE_ATLAS_OBJECTS);

    //激活平滑文理過度
    for (Texture t : atlas.getTextures()) {
        t.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
    }

    //創建遊戲資源對象
    bunny = new AssetBunny(atlas);
    rock = new AssetRock(atlas);
    goldCoin = new AssetGoldCoin(atlas);
    feather = new AssetFeather(atlas);
    levelDecoration = new AssetLevelDecoration(atlas);
    sounds = new AssetSounds(assetManager);
    music = new AssetMusic(assetManager);

    fonts = new AssetFonts();
}
 
開發者ID:davyjoneswang,項目名稱:libgdx-learnlib,代碼行數:38,代碼來源:Assets.java

示例12: AssetSounds

import com.badlogic.gdx.assets.AssetManager; //導入方法依賴的package包/類
public AssetSounds(AssetManager am) {
    jump = am.get("sounds/jump.wav", Sound.class);
    jumpWithFeather = am.get("sounds/jump_with_feather.wav", Sound.class);
    pickupCoin = am.get("sounds/pickup_coin.wav", Sound.class);
    pickupFeather = am.get("sounds/pickup_feather.wav", Sound.class);
    liveLost = am.get("sounds/live_lost.wav", Sound.class);
}
 
開發者ID:davyjoneswang,項目名稱:libgdx-learnlib,代碼行數:8,代碼來源:Assets.java

示例13: onInit

import com.badlogic.gdx.assets.AssetManager; //導入方法依賴的package包/類
@Override
protected void onInit(ScreenBasedGame game, AssetManager assetManager) {
    assetManager.load(BAR_ORANGE_IMAGE_PATH, Texture.class);
    assetManager.load(BAR_BLUE_IMAGE_PATH, Texture.class);
    assetManager.load(SPACE_IMAGE_PATH, Texture.class);
    assetManager.finishLoadingAsset(BAR_ORANGE_IMAGE_PATH);
    assetManager.finishLoadingAsset(BAR_BLUE_IMAGE_PATH);
    assetManager.finishLoadingAsset(SPACE_IMAGE_PATH);
    this.orangeBarTexture = assetManager.get(BAR_ORANGE_IMAGE_PATH, Texture.class);
    this.blueBarTexture = assetManager.get(BAR_BLUE_IMAGE_PATH, Texture.class);
    this.bgTexture = assetManager.get(SPACE_IMAGE_PATH, Texture.class);
}
 
開發者ID:opensourcegamedev,項目名稱:SpaceChaos,代碼行數:13,代碼來源:LoadingScreen.java

示例14: onInit

import com.badlogic.gdx.assets.AssetManager; //導入方法依賴的package包/類
@Override
protected void onInit(ScreenBasedGame game, AssetManager assetManager) {
    assetManager.load(LOGO_IMAGE_PATH, Texture.class);
    assetManager.load(SPACE_IMAGE_PATH, Texture.class);
    assetManager.finishLoadingAsset(LOGO_IMAGE_PATH);
    assetManager.finishLoadingAsset(SPACE_IMAGE_PATH);
    this.logoTexture = assetManager.get(LOGO_IMAGE_PATH, Texture.class);
    this.bgTexture = assetManager.get(SPACE_IMAGE_PATH, Texture.class);
}
 
開發者ID:opensourcegamedev,項目名稱:SpaceChaos,代碼行數:10,代碼來源:SplashscreenScreen.java

示例15: initAssets

import com.badlogic.gdx.assets.AssetManager; //導入方法依賴的package包/類
private void initAssets() {
    AssetManager assetManager = polymorph.getAssetManager();
    TextureAtlas textureAtlas = assetManager.get(Polymorph.MASTER_PATH, TextureAtlas.class);

    splash = textureAtlas.findRegion("splashscreen");

    for (Shape shape : Shape.values()) {
        shape.setTexture(textureAtlas.findRegion(shape.name));
    }
    for (ShapeColor shapeColor : ShapeColor.values()) {
        shapeColor.setTexture(textureAtlas.findRegion("capsule"));
    }
}
 
開發者ID:DurianHLN,項目名稱:Polymorph,代碼行數:14,代碼來源:Splash.java


注:本文中的com.badlogic.gdx.assets.AssetManager.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。