Java 类com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver 实例源码

项目:mini2Dx    文件:UATApplication.java   
@Override
public void initialise() {
    FallbackFileHandleResolver fallbackFileHandleResolver = new FallbackFileHandleResolver(
            new ClasspathFileHandleResolver(), new InternalFileHandleResolver());
    assetManager = new AssetManager(fallbackFileHandleResolver);
    assetManager.setLogger(new Logger("AssetManager", Application.LOG_ERROR));

    assetManager.setLoader(UiTheme.class, new UiThemeLoader(fallbackFileHandleResolver));
    assetManager.setLoader(TiledMap.class, new TiledMapLoader(fallbackFileHandleResolver));

    addScreen(new LoadingScreen(assetManager));
    addScreen(new UATSelectionScreen(assetManager));
    addScreen(new BlendingUAT());
    addScreen(new ClippingUAT());
    addScreen(new GeometryUAT());
    addScreen(new GraphicsUAT(assetManager));
    addScreen(new TextureRegionUAT());
    addScreen(new OrthogonalTiledMapNoCachingUAT(assetManager));
    addScreen(new OrthogonalTiledMapWithCachingUAT(assetManager));
    addScreen(new IsometricTiledMapUAT(assetManager));
    addScreen(new HexagonalTiledMapUAT(assetManager));
    addScreen(new ParticleEffectsUAT());
    addScreen(new ControllerUAT());
    addScreen(new ControllerMapping());
    addScreen(new UiUAT(assetManager));
}
项目:Polymorph    文件:Polymorph.java   
private void loadAssets() {
    InternalFileHandleResolver fileHandler = new InternalFileHandleResolver();
    assetManager = new AssetManager(fileHandler);
    assetManager.setLoader(FreeTypeFontGenerator.class, new FreeTypeFontGeneratorLoader(fileHandler));

    assetManager.load(SKIN_PATH, Skin.class);
    assetManager.load(MASTER_PATH, TextureAtlas.class);
    assetManager.load(FONT_NORMAL_PATH, FreeTypeFontGenerator.class);
    assetManager.load(FONT_BOLD_PATH, FreeTypeFontGenerator.class);
    assetManager.load(MUSIC_PATH, Music.class);
    assetManager.load(MAIN_MENU_MUSIC_PATH, Music.class);
    assetManager.load(GOOD_PATH, Sound.class);
    assetManager.load(HALF_PATH, Sound.class);
    assetManager.load(BAD_PATH, Sound.class);
    assetManager.finishLoading();
}
项目:Fruit-Destroyer    文件:Font.java   
public Font(final Application APP, String fileName, String filePath, int size, boolean filter)
{
    // ASSIGN ATTRIBUTES
    this.size = size;

    FreetypeFontLoader.FreeTypeFontLoaderParameter parameter = new FreetypeFontLoader.FreeTypeFontLoaderParameter();
    FileHandleResolver resolver = new InternalFileHandleResolver();

    APP.assets.setLoader(FreeTypeFontGenerator.class, new FreeTypeFontGeneratorLoader(resolver));
    APP.assets.setLoader(BitmapFont.class, ".otf", new FreetypeFontLoader(resolver));

    // GENERATE FONT
    if (filter) // IF FILTER ENABLED
    {
        parameter.fontParameters.genMipMaps = true;
        parameter.fontParameters.minFilter = Texture.TextureFilter.Linear;
        parameter.fontParameters.magFilter = Texture.TextureFilter.Linear;
    }
    parameter.fontFileName = filePath;
    parameter.fontParameters.size = size;

    APP.assets.load(fileName, BitmapFont.class, parameter);
    APP.assets.finishLoading();

    font = APP.assets.get(fileName, BitmapFont.class);
}
项目:Inspiration    文件:GdxFileSystem.java   
@Override
public FileHandleResolver newResolver (FileType fileType) {
    switch (fileType) {
    case Absolute:
        return new AbsoluteFileHandleResolver();
    case Classpath:
        return new ClasspathFileHandleResolver();
    case External:
        return new ExternalFileHandleResolver();
    case Internal:
        return new InternalFileHandleResolver();
    case Local:
        return new LocalFileHandleResolver();
    }
    return null; // Should never happen
}
项目:cocos-ui-libgdx    文件:AMScreen.java   
@Override
public void show() {
    super.show();
    layout = new GlyphLayout();
    font = new NativeFont(new NativeFontPaint(25));
    font.appendText("正在加载...0123456789%");
    font.setColor(Color.BLACK);
    layout.setText(font, "正在加载...100%");

    stage = new Stage(new StretchViewport(1280, 720));

    assetManager = new AssetManager();
    assetManager.setLogger(new Logger("log", Logger.DEBUG));
    assetManager.setLoader(CocosScene.class, new CocosLoader(new InternalFileHandleResolver()));
    assetManager.load("mainscene/MenuScene.json", CocosScene.class);
}
项目:throw-the-moon    文件:Moon.java   
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();

    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(); 
}
项目:throw-the-moon    文件:Background.java   
public Background(AssetManager manager) {
    manager.setLoader(Texture.class, new TextureLoader(new InternalFileHandleResolver()));
    manager.load(TEXTURE_FILENAME, Texture.class);
    manager.finishLoading();

    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));
}
项目:throw-the-moon    文件:MoonChain.java   
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();

    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());
}
项目:throw-the-moon    文件:Enemy.java   
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();

    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;
}
项目:libgdxcn    文件:FlameMain.java   
public FlameMain () {
    super("Flame");
    MathUtils.random = new RandomXS128();
    particleSystem = ParticleSystem.get();
    effect = new ParticleEffect();
    particleSystem.add(effect);
    assetManager = new AssetManager();
    assetManager.setErrorListener(this);
    assetManager.setLoader(ParticleEffect.class, new ParticleEffectLoader(new InternalFileHandleResolver()));
    controllersData = new Array<ControllerData>();

    lwjglCanvas = new LwjglCanvas(renderer = new AppRenderer());
    addWindowListener(new WindowAdapter() {
        public void windowClosed (WindowEvent event) {
            //System.exit(0);
            Gdx.app.exit();
        }
    });

    initializeComponents();

    setSize(1280, 950);
    setLocationRelativeTo(null);
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setVisible(true);
}
项目:libgdxcn    文件:TiledMapAssetManagerTest.java   
@Override
public void create () {
    float w = Gdx.graphics.getWidth();
    float h = Gdx.graphics.getHeight();

    camera = new OrthographicCamera();
    camera.setToOrtho(false, (w / h) * 10, 10);
    camera.zoom = 2;
    camera.update();

    cameraController = new OrthoCamController(camera);
    Gdx.input.setInputProcessor(cameraController);

    font = new BitmapFont();
    batch = new SpriteBatch();

    assetManager = new AssetManager();
    assetManager.setLoader(TiledMap.class, new TmxMapLoader(new InternalFileHandleResolver()));
    assetManager.load("data/maps/tiled/isometric_grass_and_water.tmx", TiledMap.class);
    assetManager.finishLoading();
    map = assetManager.get("data/maps/tiled/isometric_grass_and_water.tmx");
    renderer = new IsometricTiledMapRenderer(map, 1f / 64f);
}
项目:libgdxcn    文件:TideMapAssetManagerTest.java   
@Override
public void create () {
    float w = Gdx.graphics.getWidth();
    float h = Gdx.graphics.getHeight();

    camera = new OrthographicCamera();
    camera.setToOrtho(false, (w / h) * 10, 10);
    camera.zoom = 2;
    camera.update();

    cameraController = new OrthoCamController(camera);
    Gdx.input.setInputProcessor(cameraController);

    font = new BitmapFont();
    batch = new SpriteBatch();

    assetManager = new AssetManager();
    assetManager.setLoader(TiledMap.class, new TideMapLoader(new InternalFileHandleResolver()));
    assetManager.load("data/maps/tide/Map01.tide", TiledMap.class);
    assetManager.finishLoading();
    map = assetManager.get("data/maps/tide/Map01.tide");
    renderer = new OrthogonalTiledMapRenderer(map, 1f / 32f);
}
项目:tafl    文件:Assets.java   
public Assets(SoundService soundService,
        GraphicsService graphicsService,
        LocaleService localeService,
        TaflLevelService levelService,
        TaflGame game) {
    super(soundService, graphicsService, localeService, levelService, game);

    this.soundService = soundService;
    this.graphicsService = graphicsService;
    this.localeService = localeService;
    this.levelService = levelService;
    this.game = game;

    assetManager.setLoader(com.badlogic.gdx.scenes.scene2d.ui.Skin.class,
            new CustomSkinLoader(new InternalFileHandleResolver()));

    if (Constants.GameConstants.DEBUG) {
        assetManager.getLogger().setLevel(Logger.DEBUG);
    }
}
项目:GdxStudio    文件:Asset.java   
private static boolean loadNonBlocking(){
    if(!readinglock){
        clear();
        loadAssets();
        readinglock = true;
    }
    // once update returns true then condition is satisfied and the lock stops update call
    if(!updatinglock)
        if(assetMan.update()){
            assetMan.setLoader(TiledMap.class, new TmxMapLoader(new InternalFileHandleResolver()));
            getAssets();
            updatinglock = true;
            if(Scene.splashDuration != 0)
                Scene.nextSceneWithDelay(Scene.splashDuration);
            else
                Scene.nextScene();
        }
    return updatinglock;
}
项目:dynamicpool    文件:AssetGameScreen.java   
public void load(AssetManager assetManager) {
    background.load(assetManager);
    fish1.load(assetManager);
    fish2.load(assetManager);
    fish3.load(assetManager);
    fish4.load(assetManager);
    fish5.load(assetManager);
    fish6.load(assetManager);
    fish7.load(assetManager);
    fish8.load(assetManager);
    fish9.load(assetManager);
    fish10.load(assetManager);
    assetManager.load(AppConst.EXIT_BUTTON_TEXTURE, Texture.class);
    assetManager.load(AppConst.ADD_FISH_BUTTON_TEXTURE, Texture.class);
    assetManager.load(AppConst.SELECT_FISH_BUTTONS_TEXTURE, Texture.class);
    assetManager.load(AppConst.SELECT_TRAJECTORY_TEXTURE, Texture.class);
    FileHandleResolver resolver = new InternalFileHandleResolver();
    assetManager.setLoader(FreeTypeFontGenerator.class, new FreeTypeFontGeneratorLoader(resolver));
    assetManager.setLoader(BitmapFont.class, ".ttf", new FreetypeFontLoader(resolver));
    FreeTypeFontLoaderParameter size1Params = new FreeTypeFontLoaderParameter();
    size1Params.fontFileName = AppConst.DEFAUFT_FONT;
    size1Params.fontParameters.size =  AppConst.KEY_FONT_SIZE;
    assetManager.load(AppConst.KEY_FONT_NAME, BitmapFont.class, size1Params);
}
项目:SMC-Android    文件:Assets.java   
public Assets()
{
    textureParameter = new TextureLoader.TextureParameter();
    //textureParameter.genMipMaps = true;
    textureParameter.magFilter = Texture.TextureFilter.Linear;
    textureParameter.minFilter = Texture.TextureFilter.Linear;

    resolver = new MaryoFileHandleResolver();
    manager = new AssetManager(resolver);

    particleEffectParameter = new ParticleEffectLoader.ParticleEffectParameter();
    particleEffectParameter.imagesDir = resolver.resolve("data/animation/particles");

    // set the loaders for the generator and the fonts themselves
    manager.setLoader(FreeTypeFontGenerator.class, new FreeTypeFontGeneratorLoader(resolver));
    manager.setLoader(BitmapFont.class, ".ttf", new FreetypeFontLoader(resolver));
    manager.setLoader(ParticleEffect.class, ".p", new ParticleEffectLoader(resolver));
    manager.setLoader(Sound.class, ".mp3", new SoundLoader(new InternalFileHandleResolver()));
    manager.setLoader(Music.class, ".mp3", new MusicLoader(new InternalFileHandleResolver()));
}
项目:gdx-ai    文件:GdxFileSystem.java   
@Override
public FileHandleResolver newResolver (FileType fileType) {
    switch (fileType) {
    case Absolute:
        return new AbsoluteFileHandleResolver();
    case Classpath:
        return new ClasspathFileHandleResolver();
    case External:
        return new ExternalFileHandleResolver();
    case Internal:
        return new InternalFileHandleResolver();
    case Local:
        return new LocalFileHandleResolver();
    }
    return null; // Should never happen
}
项目:DreamsLibGdx    文件:ResourcesManager.java   
private void loadAssetsGame() {
    Gdx.app.log(Constants.LOG, "Load ResourcesManager Game");
    this.load(DEFAULT_FONT, BitmapFont.class);
    this.load(DEBUG_FONT, BitmapFont.class);
    this.load(HEADER_FONT, BitmapFont.class);
    this.load(DEBUG_BACKGROUND, Texture.class);
    this.load(MENU_BACKGROUND, Texture.class);
    this.load(STATS_BACKGROUND, Texture.class);
    this.load(SPRITE_ATLAS, TextureAtlas.class);
    this.load(VARIOS_ATLAS, TextureAtlas.class);
    this.load(OBJECTS_ATLAS, TextureAtlas.class);
    this.load(GUI_ATLAS, TextureAtlas.class);
    this.load(GUI_PACK_ATLAS, TextureAtlas.class);
    this.load(UISKIN_ATLAS, TextureAtlas.class);
    this.load(PARTICLE_EFFECT, ParticleEffect.class);
    this.load(PARTICLE_EFFECT_CONTACT, ParticleEffect.class);
    this.setLoader(TiledMap.class, new TmxMapLoader(new InternalFileHandleResolver()));
    this.load(MUSIC_MENU,Music.class);

}
项目:jrpg-engine    文件:MapMode.java   
MapMode(final MapDefinition initialMap, final TileCoordinate initialLocation,
        final AssetManager assetManager) {
    this.initialMap = initialMap;
    this.initialLocation = initialLocation;
    this.assetManager = assetManager;
    assetManager.setLoader(TiledMap.class, new TmxMapLoader(new InternalFileHandleResolver()));
    this.heroSpriteSet = GameState.getParty().getLeader().getSpriteSetDefinition();
    stateMachine = initStateMachine();
}
项目:gdxjam-ugg    文件:LoaderUtils.java   
public LoaderUtils() {
    resolver = new ResolutionFileResolver(new InternalFileHandleResolver(), resolutions);
    assetManager = new AssetManager(resolver);
    assetManager.setErrorListener(this);
    Texture.setAssetManager(assetManager);
    assetManager.setLoader(I18NBundle.class, new I18NBundleLoader(resolver));

    GUIConfig.initializeValues(resolutions);

    this.atlas = null;
    this.regions = new ObjectMap<String, AtlasRegion>();

}
项目:Fruit-Destroyer    文件:Font.java   
public Font(final Application APP, String fileName, String filePath, int size, Color color, boolean filter)
{
    // ASSIGN ATTRIBUTES
    this.size = size;
    this.color = color;

    FreetypeFontLoader.FreeTypeFontLoaderParameter parameter = new FreetypeFontLoader.FreeTypeFontLoaderParameter();
    FileHandleResolver resolver = new InternalFileHandleResolver();

    APP.assets.setLoader(FreeTypeFontGenerator.class, new FreeTypeFontGeneratorLoader(resolver));
    APP.assets.setLoader(BitmapFont.class, ".otf", new FreetypeFontLoader(resolver));

    // GENERATE FONT
    if (filter) // IF FILTER ENABLED
    {
        parameter.fontParameters.genMipMaps = true;
        parameter.fontParameters.minFilter = Texture.TextureFilter.Linear;
        parameter.fontParameters.magFilter = Texture.TextureFilter.Linear;
    }
    parameter.fontFileName = filePath;
    parameter.fontParameters.size = size;
    parameter.fontParameters.color = color;

    APP.assets.load(fileName, BitmapFont.class, parameter);
    APP.assets.finishLoading();

    font = APP.assets.get(fileName, BitmapFont.class);
}
项目:Fruit-Destroyer    文件:Font.java   
public Font(final Application APP, String fileName, String filePath, int size, Color color, Color borderColor, float borderWidth, boolean filter)
{
    // ASSIGN ATTRIBUTES
    this.size = size;
    this.color = color;

    FreetypeFontLoader.FreeTypeFontLoaderParameter parameter = new FreetypeFontLoader.FreeTypeFontLoaderParameter();
    FileHandleResolver resolver = new InternalFileHandleResolver();

    APP.assets.setLoader(FreeTypeFontGenerator.class, new FreeTypeFontGeneratorLoader(resolver));
    APP.assets.setLoader(BitmapFont.class, ".otf", new FreetypeFontLoader(resolver));

    // GENERATE FONT
    if (filter) // IF FILTER ENABLED
    {
        parameter.fontParameters.genMipMaps = true;
        parameter.fontParameters.minFilter = Texture.TextureFilter.Linear;
        parameter.fontParameters.magFilter = Texture.TextureFilter.Linear;
    }
    parameter.fontFileName = filePath;
    parameter.fontParameters.size = size;
    parameter.fontParameters.color = color;
    parameter.fontParameters.borderColor = borderColor;
    parameter.fontParameters.borderWidth = borderWidth;

    APP.assets.load(fileName, BitmapFont.class, parameter);
    APP.assets.finishLoading();

    font = APP.assets.get(fileName, BitmapFont.class);
}
项目:RavTech    文件:RavTech.java   
public RavTech (EngineConfiguration engineConfiguration) {
    this(engineConfiguration, null);    
    HookApi.addHook("onPreBoot", new Hook() {
        @Override
        public void run() {
            InternalFileHandleResolver internalFileHandleResolver = new InternalFileHandleResolver();
            AssetManager assetManager = new AssetManager(internalFileHandleResolver);
            assetManager.setLoader(String.class, new StringLoader(internalFileHandleResolver));
            assetManager.load("project.json", String.class);
            assetManager.finishLoading();
            RavTech.project = new Json().fromJson(Project.class, String.valueOf(assetManager.get("project.json", String.class)));
        }
    });     
}
项目:RavTech    文件:ShaderManager.java   
/** Adds new shader to ShaderManager, loads it using AssetManager.
 * 
 * @param am - AssetManager instance
 * @param key - shader identifier
 * @param baseVertPath - path to vertex shader source
 * @param baseFragPath - path to fragment shader source */
public void add (AssetManager am, String key, String baseVertPath, String baseFragPath) {
    am.setLoader(String.class, new TextFileLoader(new InternalFileHandleResolver()));
    FileHandle vertFh = null, fragFh = null;
    String vertPath = shaderDir + "/" + baseVertPath;
    vertFh = Gdx.files.internal(vertPath);
    if (!vertFh.exists()) {
        vertFh = Gdx.files.classpath(SHADER_CLASSPATH + "/" + baseVertPath);
        vertPath = vertFh.path();
    }
    String fragPath = shaderDir + "/" + baseFragPath;
    fragFh = Gdx.files.internal(fragPath);
    if (!fragFh.exists()) {
        fragFh = Gdx.files.classpath(SHADER_CLASSPATH + "/" + baseFragPath);
        fragPath = fragFh.path();
    }
    if (!vertFh.exists())
        throw new GdxRuntimeException("ShaderManager: shader '" + vertPath + "' does not exist!");
    if (!fragFh.exists())
        throw new GdxRuntimeException("ShaderManager: shader '" + fragPath + "' does not exist!");
    if (am.isLoaded(vertPath))
        am.unload(vertPath);
    if (am.isLoaded(fragPath))
        am.unload(fragPath);
    am.load(vertPath, String.class);
    am.load(fragPath, String.class);
    // TODO dirty...
    while (!am.isLoaded(vertPath) || !am.isLoaded(fragPath))
        am.update();
    // Gdx.app.log("ShaderManager", am.getProgress() + ", " +
    // am.getLoadedAssets() + "/" + am.getQueuedAssets());
    String vert = am.get(vertPath, String.class);
    String frag = am.get(fragPath, String.class);
    if (init(key, vert, frag))
        shaderPaths.put(key, baseVertPath + ";" + baseFragPath);
}
项目:Skyland    文件:ParticleUtils.java   
private void initManager() {
    particleManager = new AssetManager();
    ParticleEffectLoader.ParticleEffectLoadParameter loadParam = new ParticleEffectLoader.ParticleEffectLoadParameter(particleSystem.getBatches());
    ParticleEffectLoader loader = new ParticleEffectLoader(new InternalFileHandleResolver());
    particleManager.setLoader(ParticleEffect.class, loader);
    particleManager.load(Particles.PARTICLE_CLOUD_PUFF, ParticleEffect.class, loadParam);
    particleManager.load(Particles.PARTICLE_CAVE_DUST, ParticleEffect.class, loadParam);
    particleManager.finishLoading();
}
项目:throw-the-moon    文件:Player.java   
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();

    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);
}
项目:throw-the-moon    文件:Boss.java   
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();

    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;
}
项目:throw-the-moon    文件:GameStage.java   
private void loadSounds() {
    manager.setLoader(Music.class, new MusicLoader(new InternalFileHandleResolver()));
    manager.setLoader(Sound.class, new SoundLoader(new InternalFileHandleResolver()));
    manager.load(MUSIC_FILENAME, Music.class);
    manager.load(SFX_TV_ON_FILENAME, Sound.class);
    manager.finishLoading();

    music = manager.get(MUSIC_FILENAME);
    music.setLooping(true);

    tvOnSfx = manager.get(SFX_TV_ON_FILENAME);
}
项目:throw-the-moon    文件:StageClearScreen.java   
public StageClearScreen(final ThrowTheMoonGame game) {
       this.manager = new AssetManager();
       this.stage = new Stage(new StretchViewport(WIDTH, HEIGHT));

       manager.setLoader(Texture.class, new TextureLoader(new InternalFileHandleResolver()));
       manager.load(TEXTURE_FILENAME, Texture.class);
    manager.load(MUSIC_FILENAME, Music.class);
       manager.finishLoading();

       background = manager.get(TEXTURE_FILENAME);
    music = manager.get(MUSIC_FILENAME);

       Image backgroundImg = new Image(background);
       stage.addActor(backgroundImg);

       Gdx.input.setInputProcessor(stage);

       stage.addListener(new ActorGestureListener() {
        @Override
        public void tap(InputEvent event, float x, float y, int count, int button) {
            music.stop();
            game.setScreen(new GameScreen(game));
            super.tap(event, x, y, count, button);
        }
       });

    music.setLooping(true);
    music.play();
}
项目:clouboy    文件:SharedAssetManager.java   
private static void loadInternal() {

    if (Gdx.files == null) {
      throw new RuntimeException("LibGDX is not initialized yet!");
    }

    if (Gdx.files.isLocalStorageAvailable()) {
      instance = new AssetManager();
      instance.setLoader(ParticleEffect.class, new ParticleLoader(new InternalFileHandleResolver()));
    }
  }
项目:braingdx    文件:SharedAssetManager.java   
private static void loadInternal() {
   if (Gdx.files == null)
      throw new RuntimeException("LibGDX is not initialized yet!");

   instance = new AssetManager();
   // TODO make FileHandleResolver injectible
   instance.setLoader(TiledMap.class, new TmxMapLoader());
   instance.setLoader(FreeTypeFontGenerator.class, 
           new FreeTypeFontGeneratorLoader(new InternalFileHandleResolver()));
}
项目:AI_TestBed_v3    文件:Game_AI_TestBed.java   
public void restart() {

    /**
     * TEST
     */

    GameAssetManager.instance().loadAnimations("imgs/sprites/animations.json");
    GameAssetManager.instance().loadSprites("imgs/sprites/sprites.json");
    GameAssetManager.instance().loadSounds("sounds/sounds.json");

    this.am = new AssetManager();
    this.am.setLoader(TiledMap.class, new TmxMapLoader(new InternalFileHandleResolver()));
    this.am.load(getLevel(0).getLevel(), TiledMap.class);
    this.am.finishLoading();



    float w = Gdx.graphics.getWidth();
       float h = Gdx.graphics.getHeight();

       this.camera = new OrthographicCamera();
       this.camera.setToOrtho(false, w, h);
       this.camera.update();

       getLevel(0).restart();

       /*world = new World();

       world.setSystem(new SpriteSimulate(GameSettings.tickDelayGame));
       world.setSystem(new WorldSys(GameSettings.tickDelayGame));
       world.setSystem(new MapRender());
       world.setSystem(new SpriteRender());
       world.setSystem(new GameInput(GameSettings.tickDelayGame));*/

    setScreen(new ScreenActiveGame());

    Gdx.input.setInputProcessor(inputHandler);
}
项目:abattle    文件:AssetManagerImpl.java   
public AssetManagerImpl() {
  com.badlogic.gdx.assets.AssetManager _assetManager = new com.badlogic.gdx.assets.AssetManager();
  this.manager = _assetManager;
  final InternalFileHandleResolver resolver = new InternalFileHandleResolver();
  FreeTypeFontGeneratorLoader _freeTypeFontGeneratorLoader = new FreeTypeFontGeneratorLoader(resolver);
  this.manager.<FreeTypeFontGenerator, FreeTypeFontGeneratorLoader.FreeTypeFontGeneratorParameters>setLoader(FreeTypeFontGenerator.class, _freeTypeFontGeneratorLoader);
  FreetypeFontLoader _freetypeFontLoader = new FreetypeFontLoader(resolver);
  this.manager.<BitmapFont, FreetypeFontLoader.FreeTypeFontLoaderParameter>setLoader(BitmapFont.class, ".ttf", _freetypeFontLoader);
  this.fixAssetResolutions();
}
项目:gdx-lml    文件:InjectingAssetManager.java   
/** Creates a new {@link InjectingAssetManager} using the {@link InternalFileHandleResolver}. */
public InjectingAssetManager() {
    super(new InternalFileHandleResolver(), true); // Using default loaders.
    final FileHandleResolver resolver = getFileHandleResolver();
    setLoader(I18NBundle.class, new EagerI18NBundleLoader(resolver));
    setLoader(Skin.class, new EagerSkinLoader(resolver));
    setLoader(TextureAtlas.class, new EagerTextureAtlasLoader(resolver));
}
项目:sioncore    文件:Assets.java   
public Assets(String assetFile) {
        logger = new Logger(TAG, Env.debugLevel);

        logger.info("initialising");

        manager = new AssetManager();
//      manager.setErrorListener(this);
        manager.setLoader(TiledMap.class, new TmxMapLoader(new InternalFileHandleResolver()));
        manager.setLoader(PhysicsData.class, new PhysicsLoader(new InternalFileHandleResolver()));
        manager.setLoader(SpriteAnimationData.class, new SpriteAnimationLoader(new InternalFileHandleResolver()));
        manager.setLoader(SkeletonData.class, new SkeletonDataLoader(new InternalFileHandleResolver()));
        manager.setLoader(AnimationStateData.class, new AnimationStateDataLoader(new InternalFileHandleResolver()));

        loadGroups(assetFile);
    }
项目:libgdxcn    文件:AssetManagerTest.java   
public void create () {
    Gdx.app.setLogLevel(Application.LOG_ERROR);

    Resolution[] resolutions = {new Resolution(320, 480, ".320480"), new Resolution(480, 800, ".480800"),
        new Resolution(480, 856, ".480854")};
    ResolutionFileResolver resolver = new ResolutionFileResolver(new InternalFileHandleResolver(), resolutions);
    manager = new AssetManager();
    manager.setLoader(Texture.class, new TextureLoader(resolver));
    manager.setErrorListener(this);
    load();
    Texture.setAssetManager(manager);
    batch = new SpriteBatch();
    font = new BitmapFont(Gdx.files.internal("data/font.fnt"), false);
}
项目:libgdxcn    文件:TiledMapAtlasAssetManagerTest.java   
@Override
public void create () {
    float w = Gdx.graphics.getWidth();
    float h = Gdx.graphics.getHeight();

    camera = new OrthographicCamera();
    camera.setToOrtho(false, (w / h) * 10, 10);
    camera.zoom = 2;
    camera.update();

    cameraController = new OrthoCamController(camera);
    Gdx.input.setInputProcessor(cameraController);

    font = new BitmapFont();
    batch = new SpriteBatch();

    AtlasTiledMapLoaderParameters params = new AtlasTiledMapLoaderParameters();
    params.forceTextureFilters = true;
    params.textureMinFilter = TextureFilter.Linear;
    params.textureMagFilter = TextureFilter.Linear;

    assetManager = new AssetManager();
    assetManager.setErrorListener(new AssetErrorListener() {
        @Override
        public void error (AssetDescriptor asset, Throwable throwable) {
            errorMessage = throwable.getMessage();
        }
    });

    assetManager.setLoader(TiledMap.class, new AtlasTmxMapLoader(new InternalFileHandleResolver()));
    assetManager.load(fileName, TiledMap.class);
}
项目:libgdxcn    文件:FreeTypeFontLoaderTest.java   
@Override
public void create () {
    manager = new AssetManager();

    // set the loaders for the generator and the fonts themselves
    FileHandleResolver resolver = new InternalFileHandleResolver();
    manager.setLoader(FreeTypeFontGenerator.class, new FreeTypeFontGeneratorLoader(resolver));
    manager.setLoader(BitmapFont.class, ".ttf", new FreetypeFontLoader(resolver));

    // load to fonts via the generator (implicitely done by the FreetypeFontLoader).
    // Note: you MUST specify a FreetypeFontGenerator defining the ttf font file name and the size
    // of the font to be generated. The names of the fonts are arbitrary and are not pointing
    // to a file on disk!
    FreeTypeFontLoaderParameter size1Params = new FreeTypeFontLoaderParameter();
    size1Params.fontFileName = "data/arial.ttf";
    size1Params.fontParameters.size = 10;
    manager.load("size10.ttf", BitmapFont.class, size1Params);

    FreeTypeFontLoaderParameter size2Params = new FreeTypeFontLoaderParameter();
    size2Params.fontFileName = "data/arial.ttf";
    size2Params.fontParameters.size = 20;
    manager.load("size20.ttf", BitmapFont.class, size2Params);

    // we also load a "normal" font generated via Hiero
    manager.load("data/default.fnt", BitmapFont.class);

    batch = new SpriteBatch();
}
项目:GdxStudio    文件:Asset.java   
public static void loadBlocking(){
    clear();
    readinglock = true;
    updatinglock = true;
    loadAssets();
    assetMan.finishLoading();
    assetMan.setLoader(TiledMap.class, new TmxMapLoader(new InternalFileHandleResolver()));
    getAssets();
}
项目:GdxStudio    文件:Asset.java   
/***********************************************************************************************************
    *                               TMX MAP Related Functions                                              *
************************************************************************************************************/
    /*
     * Loads a Tmx map by specifying the map/level no
     * eg: loadTmx(4) -> returns the TiledMap "map/level4.tmx"
     * 
     * Note: Tmx Maps must be loaded and unloaded manually as they may take a lot of time to load
     */
    public static TiledMap map(int i){
        assetMan.setLoader(TiledMap.class, new TmxMapLoader(new InternalFileHandleResolver()));
        assetMan.load(basePath+"map/level"+i+".tmx", TiledMap.class);
        assetMan.finishLoading();
        return assetMan.get(basePath+"map/level"+i+".tmx", TiledMap.class);
    }