Java 类com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGeneratorLoader 实例源码

项目: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);
}
项目: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()));
}
项目: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);
}
项目: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()));
}
项目: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();
}
项目: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);
}
项目: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);
}
项目: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");
}
项目:CatchDROP    文件:CDGame.java   
public void create() {
    assManager = new AssetManager(); // I manage dat ass...

    FileHandleResolver resolver = new InternalFileHandleResolver();
    assManager.setLoader(FreeTypeFontGenerator.class, new FreeTypeFontGeneratorLoader(resolver));
    assManager.setLoader(BitmapFont.class, ".ttf", new FreetypeFontLoader(resolver));

    FreeTypeFontLoaderParameter titleParams = new FreeTypeFontLoaderParameter();
    titleParams.fontFileName = "font/atari.ttf";
    titleParams.fontParameters.size = 75;
    assManager.load("title.ttf", BitmapFont.class, titleParams);

    FreeTypeFontLoaderParameter promptParams = new FreeTypeFontLoaderParameter();
    promptParams.fontFileName = "font/MyriadPro-Regular.otf";
    promptParams.fontParameters.size = 35;
    assManager.load("prompt.ttf", BitmapFont.class, promptParams);

    FreeTypeFontLoaderParameter promptBoldParams = new FreeTypeFontLoaderParameter();
    promptBoldParams.fontFileName = "font/MyriadPro-Bold.otf";
    promptBoldParams.fontParameters.size = 35;
    assManager.load("prompt_bold.ttf", BitmapFont.class, promptBoldParams);

    FreeTypeFontLoaderParameter scoreParams1 = new FreeTypeFontLoaderParameter();
    scoreParams1.fontFileName = "font/atari.ttf";
    scoreParams1.fontParameters.size = 20;
    assManager.load("score.ttf", BitmapFont.class, scoreParams1);

    FreeTypeFontLoaderParameter timerParams = new FreeTypeFontLoaderParameter();
    timerParams.fontFileName = "font/atari.ttf";
    timerParams.fontParameters.size = 25;
    assManager.load("timer.ttf", BitmapFont.class, timerParams);

    FreeTypeFontLoaderParameter goverParams = new FreeTypeFontLoaderParameter();
    goverParams.fontFileName = "font/MyriadPro-Bold.otf";
    goverParams.fontParameters.size = 95;
    assManager.load("gover.ttf", BitmapFont.class, goverParams);

    FreeTypeFontLoaderParameter versionParams = new FreeTypeFontLoaderParameter();
    versionParams.fontFileName = "font/prstartk.ttf";
    versionParams.fontParameters.size = 15;
    assManager.load("corner.ttf", BitmapFont.class, versionParams);

    FreeTypeFontLoaderParameter menuFontParams = new FreeTypeFontLoaderParameter();
    menuFontParams.fontFileName = "font/MyriadPro-Bold.otf";
    menuFontParams.fontParameters.size = 25;
    assManager.load("size20.ttf", BitmapFont.class, menuFontParams);

    FreeTypeFontLoaderParameter headerParams = new FreeTypeFontLoaderParameter();
    headerParams.fontFileName = "font/arial.ttf";
    headerParams.fontParameters.size = 50;
    assManager.load("heading.ttf", BitmapFont.class, headerParams); 

    if(usingDesktop) autoPause = false;

    gamePrefs = Gdx.app.getPreferences("Game");
    //gamePrefs.getLong("highscore", 0);

    batch = new SpriteBatch();
    shapeRender = new ShapeRenderer();

    camera = new OrthographicCamera();
    camera.setToOrtho(false, GAME_WIDTH, GAME_HEIGHT);
    camera.viewportWidth = GAME_WIDTH;
    camera.viewportHeight = GAME_HEIGHT;

    mMScr = new MainMenuScreen(this);
    //gScr = new GameScreen(this);
    //gScr = new ZenGame(this);
    //gSettings = new SettingsScreen(this);

    this.setScreen(mMScr);
}
项目:vis-editor    文件:FreeTypeFontProvider.java   
@Override
public void setLoaders (AssetManager assetManager) {
    assetManager.setLoader(FreeTypeFontGenerator.class, new FreeTypeFontGeneratorLoader(assetManager.getFileHandleResolver()));
    assetManager.setLoader(BitmapFont.class, ".ttf", new FreetypeFontLoader(assetManager.getFileHandleResolver()));
}