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

项目: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
}
项目:RavTech    文件:RavFiles.java   
/** Loads the specified scene as the current Scene
 * 
 * @param sceneString - the Scene to load */
public void loadState (final String sceneString) {
    String scenePath = getAssetManager().getAssetFileName(RavTech.currentScene);
    RavTech.currentScene.dispose();
    getAssetManager().unload(scenePath);
    getAssetManager().setLoader(Scene.class, new SceneLoader(new FileHandleResolver() {
        @Override
        public FileHandle resolve (String fileName) {
            return new FileHandle() {
                @Override
                public String readString () {
                    return sceneString;
                }
            };
        }
    }));
    loadAsset(scenePath, Scene.class);
    finishLoading();
    RavTech.currentScene = getAsset(scenePath, Scene.class);
    getAssetManager().setLoader(Scene.class, new SceneLoader(getResolver()));
}
项目:libgdxcn    文件:AssetManager.java   
/** Creates a new AssetManager with all default loaders. */
public AssetManager (FileHandleResolver resolver) {
    setLoader(BitmapFont.class, new BitmapFontLoader(resolver));
    setLoader(Music.class, new MusicLoader(resolver));
    setLoader(Pixmap.class, new PixmapLoader(resolver));
    setLoader(Sound.class, new SoundLoader(resolver));
    setLoader(TextureAtlas.class, new TextureAtlasLoader(resolver));
    setLoader(Texture.class, new TextureLoader(resolver));
    setLoader(Skin.class, new SkinLoader(resolver));
    setLoader(ParticleEffect.class, new ParticleEffectLoader(resolver));
    setLoader(PolygonRegion.class, new PolygonRegionLoader(resolver));
    setLoader(I18NBundle.class, new I18NBundleLoader(resolver));
    setLoader(Model.class, ".g3dj", new G3dModelLoader(new JsonReader(), resolver));
    setLoader(Model.class, ".g3db", new G3dModelLoader(new UBJsonReader(), resolver));
    setLoader(Model.class, ".obj", new ObjLoader(resolver));
    executor = new AsyncExecutor(1);
}
项目: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);
}
项目: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
}
项目:mini2Dx    文件:SliderStyleRule.java   
@Override
public void prepareAssets(UiTheme theme, FileHandleResolver fileHandleResolver, AssetManager assetManager) {
    if (theme.isHeadless()) {
        return; 
    }
    super.prepareAssets(theme, fileHandleResolver, assetManager);

    if(sliderBar != null) {
        sliderBarNinePatch = new NinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(sliderBar)), sliderBarNinePatchLeft,
                sliderBarNinePatchRight, sliderBarNinePatchTop, sliderBarNinePatchBottom);
    }
    normalTextureRegion = new TextureRegion(theme.getTextureAtlas().findRegion(normal));
    activeTextureRegion = new TextureRegion(theme.getTextureAtlas().findRegion(active));
    hoverTextureRegion = new TextureRegion(theme.getTextureAtlas().findRegion(hover));
    disabledTextureRegion = new TextureRegion(theme.getTextureAtlas().findRegion(disabled));
}
项目:mini2Dx    文件:ParentStyleRule.java   
@Override
public void prepareAssets(UiTheme theme, FileHandleResolver fileHandleResolver, AssetManager assetManager) {
    if (theme.isHeadless()) {
        return; 
    }

    if(background != null) {
        if(getBackgroundMode().equalsIgnoreCase(BG_REPEAT_MODE)) {
            backgroundNinePatch = new RepeatedNinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(background)), getNinePatchLeft(),
                    getNinePatchRight(), getNinePatchTop(), getNinePatchBottom());
        } else {
            backgroundNinePatch = new NinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(background)), getNinePatchLeft(),
                    getNinePatchRight(), getNinePatchTop(), getNinePatchBottom());
        }
    }
}
项目:mini2Dx    文件:TextBoxStyleRule.java   
@Override
public void prepareAssets(UiTheme theme, FileHandleResolver fileHandleResolver, AssetManager assetManager) {
    if (theme.isHeadless()) {
        return; 
    }

    normalNinePatch = new NinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(normal)), getPaddingLeft(),
            getPaddingRight(), getPaddingTop(), getPaddingBottom());
    hoverNinePatch = new NinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(hover)), getPaddingLeft(),
            getPaddingRight(), getPaddingTop(), getPaddingBottom());
    actionNinePatch = new NinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(action)), getPaddingLeft(),
            getPaddingRight(), getPaddingTop(), getPaddingBottom());
    disabledNinePatch = new NinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(disabled)), getPaddingLeft(),
            getPaddingRight(), getPaddingTop(), getPaddingBottom());
    color = ColorUtils.rgbToColor(textColor);

    UiFont themeFont = theme.getFont(font);
    FreeTypeFontParameter fontParameter = new  FreeTypeFontParameter();
    fontParameter.size = fontSize;
    fontParameter.flip = true;
    if(themeFont.getBorderWidth() > 0) {
        fontParameter.borderWidth = themeFont.getBorderWidth();
        fontParameter.borderColor = themeFont.getFontBorderColor();
    }
    bitmapFont = themeFont.generateFont(fontParameter);
}
项目:mini2Dx    文件:LabelStyleRule.java   
@Override
public void prepareAssets(UiTheme theme, FileHandleResolver fileHandleResolver, AssetManager assetManager) {
    if (theme.isHeadless()) {
        return; 
    }

    super.prepareAssets(theme, fileHandleResolver, assetManager);
    if(textColor != null) {
        color = ColorUtils.rgbToColor(textColor);
    }

    UiFont themeFont = theme.getFont(font);
    FreeTypeFontParameter fontParameter = new  FreeTypeFontParameter();
    fontParameter.size = fontSize;
    fontParameter.flip = true;
    if(themeFont.getBorderWidth() > 0) {
        fontParameter.borderWidth = themeFont.getBorderWidth();
        fontParameter.borderColor = themeFont.getFontBorderColor();
    }
    bitmapFont = themeFont.generateFont(fontParameter);
}
项目:mini2Dx    文件:ScrollBoxStyleRule.java   
@Override
public void prepareAssets(UiTheme theme, FileHandleResolver fileHandleResolver, AssetManager assetManager) {
    if (theme.isHeadless()) {
        return; 
    }

    super.prepareAssets(theme, fileHandleResolver, assetManager);
    scrollTrackNinePatch = new NinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(scrollTrack)), scrollTrackNinePatchLeft,
            scrollTrackNinePatchRight, scrollTrackNinePatchTop, scrollTrackNinePatchBottom);

    scrollThumbNormalNinePatch = new NinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(scrollThumbNormal)), scrollThumbNinePatchLeft,
            scrollThumbNinePatchRight, scrollThumbNinePatchTop, scrollThumbNinePatchBottom);
    scrollThumbHoverNinePatch = new NinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(scrollThumbHover)), scrollThumbNinePatchLeft,
            scrollThumbNinePatchRight, scrollThumbNinePatchTop, scrollThumbNinePatchBottom);
    scrollThumbActiveNinePatch = new NinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(scrollThumbAction)), scrollThumbNinePatchLeft,
            scrollThumbNinePatchRight, scrollThumbNinePatchTop, scrollThumbNinePatchBottom);
}
项目:nhglib    文件:Assets.java   
public void init(Nhg nhg) {
    this.nhg = nhg;
    fsm = new DefaultStateMachine<>(this, AssetsStates.IDLE);

    assetManager = new AssetManager();
    syncAssetManager = new AssetManager();

    FileHandleResolver resolver = assetManager.getFileHandleResolver();
    FileHandleResolver syncResolver = syncAssetManager.getFileHandleResolver();

    assetManager.setLoader(Scene.class, new SceneLoader(nhg, resolver));
    assetManager.setLoader(InputProxy.class, new InputLoader(resolver));
    assetManager.setLoader(JsonValue.class, new JsonLoader(resolver));
    assetManager.setLoader(HDRData2.class, new HDRLoader(resolver));
    assetManager.setLoader(Model.class, ".g3db", new NhgG3dModelLoader(this,
            new UBJsonReader(), resolver));

    syncAssetManager.setLoader(Scene.class, new SceneLoader(nhg, syncResolver));
    syncAssetManager.setLoader(InputProxy.class, new InputLoader(syncResolver));
    syncAssetManager.setLoader(JsonValue.class, new JsonLoader(syncResolver));
    syncAssetManager.setLoader(HDRData2.class, new HDRLoader(syncResolver));
    syncAssetManager.setLoader(Model.class, ".g3db", new NhgG3dModelLoader(this,
            new UBJsonReader(), syncResolver));

    assetManager.setErrorListener(this);
    syncAssetManager.setErrorListener(this);

    assetQueue = new Array<>();
    assetCache = new ArrayMap<>();

    Texture.setAssetManager(assetManager);
}
项目: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);
}
项目:Inspiration    文件:BehaviorTreeLibrary.java   
@SuppressWarnings("rawtypes")
    private BehaviorTreeLibrary (FileHandleResolver resolver, AssetManager assetManager, int parseDebugLevel) {
        this.resolver = resolver;
//      this.assetManager = assetManager;
        this.repository = new ObjectMap<String, BehaviorTree<?>>();
        this.parser = new BehaviorTreeParser(parseDebugLevel);
    }
项目:Inspiration    文件:StandaloneFileSystem.java   
@Override
public FileHandleResolver newResolver (final FileType fileType) {
    return new FileHandleResolver() {

        @Override
        public FileHandle resolve (String fileName) {
            return new DesktopFileHandle(fileName, fileType);
        }
    };
}
项目:libgdxjam    文件:AnimationControlLoader.java   
public AnimationControlLoader(FileHandleResolver resolver, Tags tags) {
    super(resolver);

    logger.info("initialize");
    this.resolver = resolver;
    this.tags = tags;
}
项目:libgdxjam    文件:AnimationStateDataLoader.java   
public AnimationStateDataLoader(FileHandleResolver resolver) {
    super(resolver);

    logger = new Logger("AnimationStateDataLoader");
    data = null;

    logger.info("initialising");
}
项目:nvlist    文件:GdxAssetManager.java   
public GdxAssetManager(FileHandleResolver fileHandleResolver) {
    super(fileHandleResolver);

    PremultTextureLoader.register(this);
    ColorTextureLoader.register(this);
    JngTextureLoader.register(this);
    Texture.setAssetManager(this);
}
项目: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    文件:SpriteAnimationLoader.java   
/**
 * Creates a new AnimationLoader
 * 
 * @param resolver file resolver to be used
 */
public SpriteAnimationLoader(FileHandleResolver resolver) {
    super(resolver);

    animationData = null;
    logger = new Logger("Animation", Env.debugLevel);
}
项目:sioncore    文件:AnimationStateDataLoader.java   
public AnimationStateDataLoader(FileHandleResolver resolver) {
    super(resolver);

    logger = new Logger("AnimationStateDataLoader", Env.debugLevel);
    data = null;

    logger.info("initialising");
}
项目: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();
}
项目:bladecoder-adventure-engine    文件:EngineAssetManager.java   
protected EngineAssetManager(FileHandleResolver resolver) {
    super(resolver);

    resResolver = new EngineResolutionFileResolver(resolver);
    setLoader(Texture.class, new TextureLoader(resResolver));
    setLoader(TextureAtlas.class, new TextureAtlasLoader(resResolver));
    setLoader(FreeTypeFontGenerator.class, new FreeTypeFontGeneratorLoader(resolver));
    setLoader(BitmapFont.class, ".ttf", new FreetypeFontLoader(resolver));

    Texture.setAssetManager(this);
}
项目:bladecoder-adventure-engine    文件:EngineAssetManager.java   
private Resolution[] getResolutions(FileHandleResolver resolver, int worldWidth, int worldHeight) {
    ArrayList<Resolution> rl = new ArrayList<Resolution>();

    String list[] = null;

    String configRes = Config.getProperty(Config.RESOLUTIONS, null);

    if(configRes != null) {
        list = configRes.split(",");
    } else {
        list = listAssetFiles("ui");
    }

    for (String name : list) {

        try {
            float scale = Float.parseFloat(name);

            EngineLogger.debug("RES FOUND: " + scale);

            Resolution r = new Resolution((int) (worldWidth * scale), (int) (worldHeight * scale), name);

            rl.add(r);
        } catch (NumberFormatException e) {

        }
    }

    Collections.sort(rl, new Comparator<Resolution>() {
        public int compare(Resolution a, Resolution b) {
            return a.portraitWidth - b.portraitWidth;
        }
    });

    return rl.toArray(new Resolution[rl.size()]);
}
项目:dynamicpool    文件:AssetLoadingScreen.java   
public void load(AssetManager assetManager) {
    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.LOADING_FONT_SIZE;
    assetManager.load(AppConst.LOADING_FONT_NAME, BitmapFont.class, size1Params);
}
项目:vis-editor    文件:VisAssetManager.java   
public VisAssetManager (FileHandleResolver resolver, Batch batch) {
    super(resolver);
    if (batch == null) throw new IllegalStateException("Batch cannot be null");
    sceneLoader = new SceneLoader(resolver, new RuntimeConfiguration());
    sceneLoader.setBatch(batch);
    setLoader(Scene.class, sceneLoader);
    setLoader(ShaderProgram.class, new ShaderLoader());
}
项目:gdx-ai    文件:BehaviorTreeLibrary.java   
@SuppressWarnings("rawtypes")
    private BehaviorTreeLibrary (FileHandleResolver resolver, AssetManager assetManager, int parseDebugLevel) {
        this.resolver = resolver;
//      this.assetManager = assetManager;
        this.repository = new ObjectMap<String, BehaviorTree<?>>();
        this.parser = new BehaviorTreeParser(parseDebugLevel);
    }
项目:gdx-ai    文件:StandaloneFileSystem.java   
@Override
public FileHandleResolver newResolver (final FileType fileType) {
    return new FileHandleResolver() {

        @Override
        public FileHandle resolve (String fileName) {
            return new DesktopFileHandle(fileName, fileType);
        }
    };
}
项目:mini2Dx    文件:CheckboxStyleRule.java   
@Override
public void prepareAssets(UiTheme theme, FileHandleResolver fileHandleResolver, AssetManager assetManager) {
    if (theme.isHeadless()) {
        return; 
    }
    super.prepareAssets(theme, fileHandleResolver, assetManager);

    enabledNinePatch = new NinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(enabledBox)), getNinePatchLeft(),
            getNinePatchRight(), getNinePatchTop(), getNinePatchBottom());
    disabledNinePatch = new NinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(disabledBox)), getNinePatchLeft(),
            getNinePatchRight(), getNinePatchTop(), getNinePatchBottom());
    enabledCheckTextureRegion = new TextureRegion(theme.getTextureAtlas().findRegion(enabledCheck));
    disabledCheckTextureRegion = new TextureRegion(theme.getTextureAtlas().findRegion(disabledCheck));

    if(disabledUncheck != null) {
        disabledUncheckTextureRegion = new TextureRegion(theme.getTextureAtlas().findRegion(disabledUncheck));
    }
    if(enabledUncheck != null) {
        enabledUncheckTextureRegion = new TextureRegion(theme.getTextureAtlas().findRegion(enabledUncheck));
    }
    if(hoveredCheck == null) {
        hoveredCheckTextureRegion = enabledCheckTextureRegion;
    } else {
        hoveredCheckTextureRegion = new TextureRegion(theme.getTextureAtlas().findRegion(hoveredCheck));
    }
    if (hoveredUncheck != null) {
        hoveredUncheckTextureRegion = new TextureRegion(theme.getTextureAtlas().findRegion(hoveredUncheck));
    }
}
项目:mini2Dx    文件:ProgressBarStyleRule.java   
@Override
public void prepareAssets(UiTheme theme, FileHandleResolver fileHandleResolver, AssetManager assetManager) {
    if (theme.isHeadless()) {
        return; 
    }
    if (background != null) {
        backgroundNinePatch = new NinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(background)),
                getBackgroundNinePatchLeft(), getBackgroundNinePatchRight(), getBackgroundNinePatchTop(),
                getBackgroundNinePatchBottom());
    }
    fillNinePatch = new NinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(fill)), fillNinePatchLeft,
            fillNinePatchRight, fillNinePatchTop, fillNinePatchBottom);
}
项目:mini2Dx    文件:UiFont.java   
public void prepareAssets(UiTheme theme, FileHandleResolver fileHandleResolver) {
    if(theme.isHeadless()) {
        return;
    }

    fontGenerator = new FreeTypeFontGenerator(fileHandleResolver.resolve(path));
    if(borderColor != null) {
        fontBorderColor = ColorUtils.rgbToColor(borderColor);
    }
}
项目:mini2Dx    文件:RadioButtonStyleRule.java   
@Override
public void prepareAssets(UiTheme theme, FileHandleResolver fileHandleResolver, AssetManager assetManager) {
    if (theme.isHeadless()) {
        return; 
    }

    super.prepareAssets(theme, fileHandleResolver, assetManager);
    activeTextureRegion = new TextureRegion(theme.getTextureAtlas().findRegion(active));
    inactiveTextureRegion = new TextureRegion(theme.getTextureAtlas().findRegion(inactive));
    disabledActiveTextureRegion = new TextureRegion(theme.getTextureAtlas().findRegion(disabledActive));
    disabledInactiveTextureRegion = new TextureRegion(theme.getTextureAtlas().findRegion(disabledInactive));

    if(activeHover != null) {
        activeHoverTextureRegion = new TextureRegion(theme.getTextureAtlas().findRegion(activeHover));
    } else {
        activeHoverTextureRegion = activeTextureRegion;
    }
    if(inactiveHover != null) {
        inactiveHoverTextureRegion = new TextureRegion(theme.getTextureAtlas().findRegion(inactiveHover));
    } else {
        inactiveHoverTextureRegion = inactiveTextureRegion;
    }
    if(disabledActiveHover != null) {
        disabledActiveHoverTextureRegion = new TextureRegion(theme.getTextureAtlas().findRegion(disabledActiveHover));
    } else {
        disabledActiveHoverTextureRegion = disabledActiveTextureRegion;
    }
    if(disabledInactiveHover != null) {
        disabledInactiveHoverTextureRegion = new TextureRegion(theme.getTextureAtlas().findRegion(disabledInactiveHover));
    } else {
        disabledInactiveHoverTextureRegion = disabledInactiveTextureRegion;
    }
}
项目:mini2Dx    文件:SelectStyleRule.java   
@Override
public void prepareAssets(UiTheme theme, FileHandleResolver fileHandleResolver, AssetManager assetManager) {
    if (theme.isHeadless()) {
        return; 
    }

    super.prepareAssets(theme, fileHandleResolver, assetManager);
    if(background != null) {
        backgroundNinePatch = new NinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(background)), getNinePatchLeft(),
                getNinePatchRight(), getNinePatchTop(), getNinePatchBottom());
    }
}
项目:mini2Dx    文件:ButtonStyleRule.java   
@Override
public void prepareAssets(UiTheme theme, FileHandleResolver fileHandleResolver, AssetManager assetManager) {
    if (theme.isHeadless()) {
        return; 
    }

    if(normal != null) {
        normalNinePatch = new NinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(normal)), getNinePatchLeft(),
                getNinePatchRight(), getNinePatchTop(), getNinePatchBottom());
    }
    if(hover != null) {
        hoverNinePatch = new NinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(hover)), getNinePatchLeft(),
                getNinePatchRight(), getNinePatchTop(), getNinePatchBottom());
    }
    if(action != null) {
        actionNinePatch = new NinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(action)), getNinePatchLeft(),
                getNinePatchRight(), getNinePatchTop(), getNinePatchBottom());
    }
    if(disabled != null) {
        disabledNinePatch = new NinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(disabled)), getNinePatchLeft(),
                getNinePatchRight(), getNinePatchTop(), getNinePatchBottom());
    }

    UiFont themeFont = theme.getFont(font);
    FreeTypeFontParameter fontParameter = new  FreeTypeFontParameter();
    fontParameter.size = fontSize;
    fontParameter.flip = true;
    if(themeFont.getBorderWidth() > 0) {
        fontParameter.borderWidth = themeFont.getBorderWidth();
        fontParameter.borderColor = themeFont.getFontBorderColor();
    }
    bitmapFont = themeFont.generateFont(fontParameter);

    if(textColor != null) {
        color = ColorUtils.rgbToColor(textColor);
    }
}
项目:mini2Dx    文件:UiEditor.java   
public UiEditor(String directory, String gameThemePath) {
    super();
    this.directory = directory;
    this.gameThemePath = gameThemePath;

    FileHandleResolver fileHandleResolver = new FallbackFileHandleResolver(new ClasspathFileHandleResolver(),
            new InternalFileHandleResolver());
    assetManager = new AssetManager(fileHandleResolver);
    assetManager.setLoader(UiTheme.class, new UiThemeLoader(fileHandleResolver));
    assetManager.load(UiTheme.DEFAULT_THEME_FILENAME, UiTheme.class);
    assetManager.load(gameThemePath, UiTheme.class);

    uiContainer = new UiContainer(this, assetManager);
}
项目:mini2Dx    文件:FallbackFileHandleResolver.java   
/**
 * Constructor
 * 
 * @param resolvers
 *            The {@link FileHandleResolver}s in priority order. The first
 *            resolver has the highest priority.
 */
public FallbackFileHandleResolver(FileHandleResolver... resolvers) {
    if (resolvers.length == 0) {
        throw new MdxException(FallbackFileHandleResolver.class.getSimpleName() + " requires at least 1 "
                + FileHandleResolver.class.getSimpleName());
    }

    this.resolvers = new ArrayList<FileHandleResolver>();
    for (int i = 0; i < resolvers.length; i++) {
        this.resolvers.add(resolvers[i]);
    }
}
项目:mini2Dx    文件:FallbackFileHandleResolver.java   
@Override
public FileHandle resolve(String fileName) {
    for (FileHandleResolver resolver : resolvers) {
        FileHandle result = resolver.resolve(fileName);
        if (result == null) {
            continue;
        }
        if (!result.exists()) {
            continue;
        }
        return result;
    }
    return null;
}
项目:ingress-indonesia-dev    文件:AssetManager.java   
public AssetManager(FileHandleResolver paramFileHandleResolver)
{
  setLoader(BitmapFont.class, new BitmapFontLoader(paramFileHandleResolver));
  setLoader(Music.class, new MusicLoader(paramFileHandleResolver));
  setLoader(Pixmap.class, new PixmapLoader(paramFileHandleResolver));
  setLoader(Sound.class, new SoundLoader(paramFileHandleResolver));
  setLoader(TextureAtlas.class, new TextureAtlasLoader(paramFileHandleResolver));
  setLoader(Texture.class, new TextureLoader(paramFileHandleResolver));
  setLoader(Skin.class, new SkinLoader(paramFileHandleResolver));
  setLoader(TileAtlas.class, new TileAtlasLoader(paramFileHandleResolver));
  setLoader(TileMapRenderer.class, new TileMapRendererLoader(paramFileHandleResolver));
  this.threadPool = Executors.newFixedThreadPool(1, new AssetManager.1(this));
}
项目:ProjektGG    文件:ProjektGG.java   
@Override
public final void create() {
    if (debug)
        Gdx.app.setLogLevel(Gdx.app.LOG_DEBUG);
    else
        Gdx.app.setLogLevel(Gdx.app.LOG_INFO);

    // Initialize sprite batch
    this.batch = new SpriteBatch();

    // Initialize asset manager
    FileHandleResolver resolver = new InternalFileHandleResolver();
    this.assetManager.setLoader(FreeTypeFontGenerator.class,
            new FreeTypeFontGeneratorLoader(resolver));
    this.assetManager.setLoader(BitmapFont.class, ".ttf",
            new FreetypeFontLoader(resolver));

    this.viewportWidth = Gdx.graphics.getWidth();
    this.viewportHeight = Gdx.graphics.getHeight();

    // Initialize cameras
    this.uiCamera = new OrthographicCamera(viewportWidth, viewportHeight);
    this.uiCamera.translate(viewportWidth / 2, viewportHeight / 2, 0);
    this.uiCamera.update();

    this.gameCamera = new PerspectiveCamera(0, viewportWidth,
            viewportHeight);
    this.gameCamera.translate(viewportWidth / 2, viewportHeight / 2, 0);
    // this.camera.update();
    this.batch.setProjectionMatrix(this.gameCamera.combined);

    // Create new cursor manager
    this.cursorManager = new CursorManager();

    // Load game settings
    this.settings = new Settings("projekt-gg");

    // Set input processor
    Gdx.input.setInputProcessor(inputProcessor);

    // Add screens
    addScreen("splash", new SplashScreen());
    addScreen("mainMenu", new MainMenuScreen());
    addScreen("loading", new LoadingScreen());
    addScreen("serverBrowser", new ServerBrowserScreen());
    addScreen("lobby", new LobbyScreen());
    addScreen("lobbyCreation", new LobbyCreationScreen());
    addScreen("map", new GameMapScreen());
    addScreen("house", new GameHouseScreen());
    addScreen("roundEnd", new GameRoundendScreen());

    // Push screen
    if (showSplashscreen)
        pushScreen("splash");
    else
        pushScreen("loading");
}