当前位置: 首页>>代码示例>>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;未经允许,请勿转载。