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

项目:KyperBox    文件:GameState.java   
public GameState(String name, String tmx, StateManager manager) {
    this.tmx = tmx;
    setManager(manager);
    if(name!=null)
    this.name = name;
    else
        this.name = "";
    sprites = new ObjectMap<String, Sprite>();
    animations = new ObjectMap<String, Animation<String>>();
    fonts = new ObjectMap<String, BitmapFont>(); //TODO: test load to avoid repeats
    particle_effects = new ObjectMap<String, ParticleEffectPool>();
    pvalues = new Array<String>();
    time_scale = 1f;
    shaders = new ObjectMap<String, ShaderProgram>();
    svalues = new Array<String>();
}
项目:ProjektGG    文件:LoadingScreen.java   
private void onFinishedLoading() {
    BitmapFont main19Font = assetManager.get(MAIN_FONT_19_PATH());
    BitmapFont main22Font = assetManager.get(MAIN_FONT_22_PATH());
    BitmapFont letter20Font = assetManager.get(LETTER_FONT_20_PATH());
    BitmapFont handwritten20Font = assetManager
            .get(HANDWRITTEN_FONT_20_PATH());

    ObjectMap<String, Object> fontMap = new ObjectMap<String, Object>();
    fontMap.put("main-19", main19Font);
    fontMap.put("main-22", main22Font);
    fontMap.put("letter-20", letter20Font);
    fontMap.put("handwritten-20", handwritten20Font);
    assetManager.load(SKIN_PATH, Skin.class,
            new SkinLoader.SkinParameter(SKIN_TEXTURE_ATLAS_PATH, fontMap));
    assetManager.finishLoadingAsset(SKIN_PATH);

    // game.setUISkin(assetManager.get(SKIN_PATH));
    VisUI.load();
    game.setUISkin(VisUI.getSkin());

    // Notify loaded screens
    game.getScreen("serverBrowser").finishLoading();

    game.pushScreen("mainMenu");
}
项目:libgdx-learnlib    文件:WorldRenderer.java   
private void renderGuiFpsCounter(SpriteBatch batch) {
    float x = cameraGUI.viewportWidth - 55;
    float y = cameraGUI.viewportHeight - 15;
    int fps = Gdx.graphics.getFramesPerSecond();
    BitmapFont fpsFont = Assets.instance.fonts.defaultNormal;
    if (fps >= 45) {
        // 45 or more FPS show up in green
        fpsFont.setColor(0, 1, 0, 1);
    } else if (fps >= 30) {
        // 30 or more FPS show up in yellow
        fpsFont.setColor(1, 1, 0, 1);
    } else {
        // less than 30 FPS show up in red
        fpsFont.setColor(1, 0, 0, 1);
    }
    fpsFont.draw(batch, "FPS: " + fps, x, y);
    fpsFont.setColor(1, 1, 1, 1);
}
项目:libgdx-learnlib    文件:Assets.java   
public AssetFonts() {
    // Create three fonts using libGdx's 15px bitmap font
    defaultSmall = new BitmapFont(Gdx.files.internal("images/arial-15.fnt"), true);
    defaultNormal = new BitmapFont(Gdx.files.internal("images/arial-15.fnt"), true);
    defaultBig = new BitmapFont(Gdx.files.internal("images/arial-15.fnt"), true);

    // set font sizes
    defaultSmall.getData().setScale(0.75f);
    defaultNormal.getData().setScale(1.0f);
    defaultBig.getData().setScale(2.0f);

    // enable linear texture filtering for smooth fonts
    defaultSmall.getRegion().getTexture().setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
    defaultNormal.getRegion().getTexture().setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
    defaultBig.getRegion().getTexture().setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
}
项目:Flappy-Baranus    文件:GameOver.java   
public GameOver(GameStateManager gsm, int score) {
    super(gsm);
    this.score = score;
    camera.setToOrtho(false, FlappyBaran.WIDTH / 2, FlappyBaran.HEIGHT / 2);
    background = new Texture("backgrnd.jpg");
    gameover = new Texture("gameover.png");
    font = new BitmapFont();
    prefs = Gdx.app.getPreferences("FlappyBaran");

    if (!prefs.contains("highScore")) {
        prefs.putInteger("highScore", 0);
    }

    prevHighScore = getHighScore();

    if (prevHighScore < this.score) {
        setHighScore(this.score);
        highscore = this.score;
    } else {
        highscore = prevHighScore;
    }

}
项目:DarkDay    文件:Hud.java   
public Hud(SpriteBatch sb) {
    countKill = 0;
    viewport = new FitViewport(ScreenConf.V_WIDTH, ScreenConf.V_HEIGHT, new OrthographicCamera());

    stage = new Stage(viewport, sb);

    Table table = new Table();
    table.setFillParent(true);
    table.top();

    countKillLabel = new Label(String.format("%03d", countKill), new Label.LabelStyle(new BitmapFont(), Color.WHITE));

    table.add(countKillLabel).expandX().padTop(10);
    table.add().expandX();
    table.add().expandX();
    table.add().expandX();
    stage.addActor(table);

}
项目:SpaceChaos    文件:FilledIconBar.java   
public FilledIconBar(Texture heartTexture, BitmapFont font) {
    super();

    this.font = font;

    // add heart icon
    this.heartImageWidget = new ImageWidget(heartTexture);
    this.heartImageWidget.setPosition(0, 0);
    this.addWidget(this.heartImageWidget);

    // add health widget
    this.filledBar = new FilledBar(this.font);
    this.filledBar.setPosition(40, 6);
    this.filledBar.setDimension(80, 20);
    this.addWidget(this.filledBar);
}
项目:KyperBox    文件:GameState.java   
private void loadFonts(TiledMap data, String atlasname) {
    MapObjects objects = data.getLayers().get("preload").getObjects();
    String ffcheck = "Font";
    for (MapObject o : objects) {
        String name = o.getName();
        BitmapFont font = null;
        MapProperties properties = o.getProperties();
        String type = properties.get("type", String.class);
        String fontfile = properties.get("font_file", String.class);
        if (fontfile != null && type != null && type.equals(ffcheck)) {
            boolean markup = properties.get("markup", false, boolean.class);
            game.loadFont(fontfile, atlasname);
            game.getAssetManager().finishLoading();
            font = game.getFont(fontfile);
            fonts.put(name, font);
            font.getData().markupEnabled = markup;
        }
    }
}
项目:ExamensArbeteTD    文件:Assets.java   
private static BitmapFont createFont(int fontSize , Fonts type) {
    FileHandle fontFile = null;
    switch(type){
        case HEMI_HEAD: fontFile = Gdx.files.internal("fonts/HEMIHEAD.TTF"); break;
        case VERA: fontFile = Gdx.files.internal("fonts/Vera.ttf"); break;
        case VERA_BD: fontFile = Gdx.files.internal("fonts/VeraBd.ttf"); break;
default:
    break;
    }
      FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontFile);
      FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
      parameter.size = fontSize;

      BitmapFont font = generator.generateFont(parameter);
      generator.dispose();
      return font;
  }
项目:SpaceChaos    文件:BitmapFontFactory.java   
public static BitmapFont createFont(String fontPath, int size, Color color, Color borderColor, int borderWidth) {
    // load font
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.absolute(fontPath));
    FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();

    // https://github.com/libgdx/libgdx/wiki/Gdx-freetype
    parameter.size = size;
    parameter.borderColor = borderColor;
    parameter.borderWidth = borderWidth;
    parameter.color = color;

    BitmapFont font48 = generator.generateFont(parameter);
    generator.dispose();

    return font48;
}
项目:gdx-splash    文件:SplashScreen.java   
@Override
public void create() {
    VisUI.load();
    batch = new SpriteBatch();
    shapeRenderer = new ShapeRenderer();
    img = new Texture("splash.png");
    font = new BitmapFont(Gdx.files.internal("font/openSans.fnt"), Gdx.files.internal("font/openSans.png"), false, true);

    window = ((Lwjgl3Graphics) Gdx.graphics).getWindow();

    // start loading
    loadingTask = new LoadingTask();
    try {
        loadingTask.execute();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:EarthInvadersGDX    文件:MenuScreen.java   
public MenuScreen() {
    camera = new OrthographicCamera();
    viewport = new FitViewport(Game.WIDTH, Game.HEIGHT, camera);
    viewport.apply();
    camera.position.set(Game.WIDTH / 2, Game.HEIGHT / 2, 0);
    camera.update();
    betaText = new BitmapFont(Gdx.files.internal("score.fnt"), Gdx.files.internal("score.png"), false);
    betaText.getData().setScale(0.35f);
    logo = new Sprite(new Texture("logo.png"));
    Random r = new Random();
    background = new Particle[r.nextInt(55 - 45) + 45];
    for (int i = 0; i < background.length; i++) {
        int size = r.nextInt(4) + 1;
        int x = r.nextInt(Game.WIDTH);
        int y = r.nextInt(Game.HEIGHT);
        background[i] = new Particle(x, y, 0, 0, -1, new Color(207 / 255f, 187 / 255f, 20 / 255f, 1f), size);
    }
    musicMuted = new Sprite(new Texture(Gdx.files.internal("buttons/music_muted.png")));
    musicUnmuted = new Sprite(new Texture(Gdx.files.internal("buttons/music_unmuted.png")));
    play = new CenteredButton(500, "buttons/play.png");
    music = new Button(Game.WIDTH - 130, 15, Game.musicMuted() ? musicMuted : musicUnmuted);
    music.setScale(4f);
}
项目:CursedEcho    文件:LoginScreen.java   
@Override
public void show() {
    Gdx.input.setInputProcessor(stage);
    GameUtils.getGame().assets.put("Players/player.png", Texture.class);
    GameUtils.getGame().assets.put("World/grass.png", Texture.class);
    GameUtils.getGame().assets.put("Fonts/HUDFont.fnt", BitmapFont.class);

    switch(Gdx.app.getType()) {
    case Android:
        GameUtils.getGame().assets.put("Controls/touchBackground.png", Texture.class);
        GameUtils.getGame().assets.put("Controls/touchKnob.png", Texture.class);
        break;
    default:
        break;
    }
}
项目:libgdx-crypt-texture    文件:TestCryptTextureAtlas.java   
@Override
public void create() {
    batch = new SpriteBatch();

    font = new BitmapFont();
    font.setColor(0, 0, 1, 1);

    // Origin
    TextureAtlas originTextureAtlas = new TextureAtlas(ORIGIN_PATH + "/test.atlas");
    Skin originSkin = new Skin(originTextureAtlas);
    originTextureRegion = originSkin.getRegion("badlogic");

    // Encrypt
    SimpleXorCryptoEncryptor.process("123", "atlas", "encryptedAtlas");

    // Decrypt
    CryptTextureAtlas cryptTextureAtlas = new CryptTextureAtlas(crypto, ENCRYPTED_PATH + "/test.atlas");
    Skin skin = new Skin(cryptTextureAtlas);
    decryptTextureRegion = skin.getRegion("badlogic");
}
项目:Tower-Defense-Galaxy    文件:MessageWindow.java   
public MessageWindow(String message, BitmapFont font, float width, float height) {
    setTouchable(Touchable.enabled);
    setBounds(width / 2 - width / 4, height / 2 - height / 10, width / 2, height / 5);
    texture = new Texture("theme/basic/ui/Window.png");
    this.message = message;
    table = new Table();
    table.setSize(getWidth(), getHeight());
    table.align(Align.center | Align.top);
    table.setPosition(getX(), getY());
    Label label = new Label(message, new Label.LabelStyle(font, Color.BLACK));
    label.setWrap(true);
    label.setFontScale(0.7f);
    Label label2 = new Label("Tap to continue", new Label.LabelStyle(font, Color.BLACK));
    label2.setFontScale(0.6f);
    table.add(label).width(getWidth());
    table.row();
    table.add(label2).width(getWidth()).expandY();
    table.pad(0, 30, 0, 30);
}
项目:StarshipFighters    文件:GameOverState.java   
@Override
public void init() {

    // Start Sound and Music
    musicManager = gsm.getGame().getMusicManager();
    soundManager = gsm.getGame().getSoundManager();
    soundManager.addSound(selectSound, choiceOptionName);

    // Start Bitmap Font
    bitmapFont = new BitmapFont();
    //bitmapFont.getData().setScale(3);

    // Spritebatch start
    spriteBatch = game.getSpriteBatch();

    // Current Option Start
    currentOption = 0;

    // Add Sound effect
    soundManager.addSound(selectSound, choiceOptionName);

}
项目:Klooni1010    文件:SkinLoader.java   
static Skin loadSkin() {
    String folder = "ui/x" + bestMultiplier + "/";

    // Base skin
    Skin skin = new Skin(Gdx.files.internal("skin/uiskin.json"));

    // Nine patches
    final int border = (int)(28 * bestMultiplier);
    skin.add("button_up", new NinePatch(new Texture(
            Gdx.files.internal(folder + "button_up.png")), border, border, border, border));

    skin.add("button_down", new NinePatch(new Texture(
            Gdx.files.internal(folder + "button_down.png")), border, border, border, border));

    for (String id : ids) {
        skin.add(id + "_texture", new Texture(Gdx.files.internal(folder + id + ".png")));
    }

    folder = "font/x" + bestMultiplier + "/";
    skin.add("font", new BitmapFont(Gdx.files.internal(folder + "geosans-light64.fnt")));
    skin.add("font_small", new BitmapFont(Gdx.files.internal(folder + "geosans-light32.fnt")));
    skin.add("font_bonus", new BitmapFont(Gdx.files.internal(folder + "the-next-font.fnt")));

    return skin;
}
项目:Polymorph    文件:DeathScreen.java   
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);

}
项目:ProjektGG    文件:LoadingScreen.java   
public final AssetDescriptor<BitmapFont> MAIN_FONT_19_PATH() {
    FreeTypeFontLoaderParameter font = new FreeTypeFontLoaderParameter();
    font.fontFileName = "fonts/AlemdraSC/AlmendraSC-Regular.ttf";
    font.fontParameters.size = 19;
    return new AssetDescriptor<BitmapFont>("mainFont19.ttf",
            BitmapFont.class, font);
}
项目:ProjektGG    文件:LoadingScreen.java   
public final AssetDescriptor<BitmapFont> MAIN_FONT_22_PATH() {
    FreeTypeFontLoaderParameter font = new FreeTypeFontLoaderParameter();
    font.fontFileName = "fonts/AlemdraSC/AlmendraSC-Regular.ttf";
    font.fontParameters.size = 22;
    return new AssetDescriptor<BitmapFont>("mainFont22.ttf",
            BitmapFont.class, font);
}
项目:ProjektGG    文件:LoadingScreen.java   
public final AssetDescriptor<BitmapFont> HANDWRITTEN_FONT_20_PATH() {
    FreeTypeFontLoaderParameter font = new FreeTypeFontLoaderParameter();
    font.fontFileName = "fonts/ReenieBeanie/ReenieBeanie.ttf";
    font.fontParameters.size = 20;
    return new AssetDescriptor<BitmapFont>("handwrittenFont20.ttf",
            BitmapFont.class, font);
}
项目:ggvm    文件:PCMenu.java   
@Override
public void setDependencies(String fontFileName, String fontBitmapFileName, GGVm ggvm, InputProcessorBase inputProcessor, SoundtrackManager soundtrackManager) {
    FileHandle fontFileHandle = Gdx.files.internal(fontFileName);
    FileHandle fontBitmapFileHandle = Gdx.files.internal(fontBitmapFileName);
    bitmapFont = new BitmapFont(fontFileHandle, fontBitmapFileHandle, false);
    topLevelMenu = new TopLevelMenu();
    promptInputMenu = new PromptInputMenu();
    menu = topLevelMenu;
    this.ggvm = ggvm;
    this.inputProcessor = (KeyboardInputProcessor) inputProcessor;
    this.soundtrackManager = soundtrackManager;
}
项目:Hexpert    文件:Hexpert.java   
public BitmapFont getFont() {
    if (font == null) {
        FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/VCROSDMono.ttf"));
        FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
        parameter.size = 35;
        parameter.borderWidth = 1;
        parameter.color = Color.BLACK;
        font = generator.generateFont(parameter);
        generator.dispose();
    }
    return font;
}
项目:Catan    文件:TradeWindow.java   
private BitmapFont getFont() {
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/DroidSans.ttf"));
    FreeTypeFontParameter parameter = new FreeTypeFontParameter();
    parameter.size = 20;
    BitmapFont font = generator.generateFont(parameter);
    generator.dispose();
    return font;
}
项目:FlappyChapa    文件:PlayState.java   
public PlayState(GameStateManager gsm) {
        super(gsm);
        score = 0;
        chapa = new Chapa(50, 300);
        camera.setToOrtho(false, FlappyChapa.WIDTH / 2, FlappyChapa.HEIGHT / 2);
        Texture texture = new Texture("bg.png");
        backGround = new org.academiadecodigo.bootcamp.sprites.Background(camera);
        backGround.start();
        ground = new Texture("ground.png");
        /*table = new Table();
        table.setPosition(camera.position.x,camera.position.y);
        //table.setBounds(camera.position.x,camera.position.y,camera.viewportWidth,camera.viewportHeight/10);
        table.setFillParent(true);*/
        scoreLabel = new Label(String.format("%06d", score), new Label.LabelStyle(new BitmapFont(), Color.WHITE));
        scoreLabel.setPosition(camera.position.x,0);
        startTime = TimeUtils.nanoTime();
        anto = new Anto(camera);
//        groundPos1 = new Vector2(camera.position.x - camera.viewportWidth / 2, GROUND_Y_OFFSET);
//        groundPos2 = new Vector2((camera.position.x - camera.viewportWidth / 2) + ground.getWidth(), GROUND_Y_OFFSET);
        tubes = new Array<Tube>();
        for (int i = 0; i < TUBE_COUNT; i++) {
            tubes.add(new Tube(i * (TUBE_SPACING + Tube.TUBE_WIDTH)));
        }

        music = Gdx.audio.newMusic(Gdx.files.internal("bigSmoke_justAudio.mp3"));
        music.setLooping(true);
        music.setVolume(0.5f);
        music.play();
    }
项目:Ponytron    文件:AssetDoctor.java   
public static BitmapFont getFont(String id, String file, Color color, int size) {
    FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
    parameter.size = size;
    parameter.color = color;
    FreeTypeFontGenerator gen = new FreeTypeFontGenerator(Gdx.files.internal(file));
    BitmapFont font = gen.generateFont(parameter);
    font.getRegion().getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear);
    return font;
}
项目:Parasites-of-HellSpace    文件:LoadingScreen.java   
@Override
public void show()
{
    batch = new SpriteBatch();
    splashScreen = new Texture("loadscreen.png");
    loaded = false;
    font = new BitmapFont(Gdx.files.internal("sans.fnt"), false);

    AssetLoader.create();
}
项目:drc-sim-client    文件:TextUtil.java   
public static BitmapFont generateScaledFont(float scale) {
    int size = (int) (50f * Gdx.graphics.getHeight() * scale / 720f);
    if (fonts.containsKey(size))
        return fonts.get(size);
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("font/coolvetica.ttf"));
    FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
    parameter.size = size;
    FreeTypeFontGenerator.setMaxTextureSize(FreeTypeFontGenerator.NO_MAXIMUM);
    BitmapFont font = generator.generateFont(parameter);
    generator.dispose();
    fonts.put(size, font);
    return font;
}
项目:SpaceChaos    文件:BitmapFontFactory.java   
public static BitmapFont createFont(String fontPath, int size, Color color) {
    // load font
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.absolute(fontPath));
    FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
    parameter.size = size;
    parameter.color = color;

    BitmapFont font48 = generator.generateFont(parameter);
    generator.dispose();

    return font48;
}
项目:arcadelegends-gg    文件:InputSettingsScreen.java   
private void initInputRows(BitmapFont font, TextureRegion backgroundTexture)
{
    for (int i = 0; i < keys.length; i++) {
        Label lbKey = new Label(keys[i].getKeyName().substring(0, 1).toUpperCase() + keys[i].getKeyName().substring(1), skin);
        lbKey.setAlignment(Align.center);
        keyMap.put(keys[i].getKeyName(), i);


        TextButton btKey = new TextButton(Input.Keys.toString(IInputConfig.InputKeys.getFromKey(keys[i], AL.getInputConfig())), skin);
        btKey.setText(btKey.getText().toString().toUpperCase());
        btKey.center();
        btKey.setName(keys[i].getKeyName());

        btKey.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                showDialog(font, backgroundTexture, btKey.getName(), btKey);


            }
        });
        inputTable.add(lbKey).pad(10).fill();
        inputTable.add(btKey).pad(10).fill();
        inputTable.row();
    }


    scrollPane = new ScrollPane(inputTable, skin);
    scrollPane.setSize(500, 900);
    scrollPane.setPosition(1920 / 2 - 250, 1080 / 2 - 400);
    stage.addActor(scrollPane);
}
项目:miniventure    文件:MyUtils.java   
public static void writeOutlinedText(BitmapFont font, SpriteBatch batch, String text, float x, float y, Color center, Color outline) {
    font.setColor(outline);
    font.draw(batch, text, x-1, y-1);
    font.draw(batch, text, x-1, y+1);
    font.draw(batch, text, x+1, y-1);
    font.draw(batch, text, x+1, y+1);
    font.setColor(center);
    font.draw(batch, text, x, y);
}
项目:EarthInvadersGDX    文件:ShopEntry.java   
public ShopEntry(String title, int cost, Sprite texture, BitmapFont font) {
    this.title = title;
    this.cost = cost;
    this.texture = texture;
    this.font = font;
    buyButton = new TextButton(0, 0, 235, 90, "buttons/price.png", font, String.valueOf(cost));
}
项目:CursedEcho    文件:AssetHandler.java   
public void loadProgressBar(String progressBar, String baseImg, String background, String fontPath) {
    //load assets needed
    load(progressBar,Texture.class);
    load(baseImg,Texture.class);
    load(background,Texture.class);
    load(fontPath,BitmapFont.class);
    finishLoading();

    //assign assets that were loaded
    progressBarImg = get(progressBar,Texture.class);
    progressBarBaseImg = get(baseImg,Texture.class);
    backgroundImg = get(background,Texture.class);
    font = get(fontPath,BitmapFont.class);
    font.getData().markupEnabled = true;
}
项目:CursedEcho    文件:LoadingScreen.java   
public void initDestinationAssets() {
    if(destination.equals("menu")) {
        GameUtils.getGame().mainFont = GameUtils.getGame().assetHandler.get("Fonts/mainFont.fnt",BitmapFont.class);
        GameUtils.getGame().mainFont.getData().markupEnabled = true;
    }else if(destination.equals("game")) {
        GameUtils.getGame().HUDFont = GameUtils.getGame().assetHandler.get("Fonts/HUDFont.fnt",BitmapFont.class);
        GameUtils.getGame().HUDFont.getData().markupEnabled = true;
    }
}
项目:Tower-Defense-Galaxy    文件:TDGalaxy.java   
@Override
public void dispose() {
       if(debugger != null)
           debugger.disposeWindow("Controllers");
       if(vr != null && preferences.isVr())
           vr.close();
    List<BitmapFont> fontArray = new ArrayList<BitmapFont>(fonts.values());
    for(BitmapFont font: fontArray)
        font.dispose();
}
项目:Cubes_2    文件:Fonts.java   
public static BitmapFont getFont(int size) {
    BitmapFont f = readFont(size);
    if (f == null)
        f = writeFont(size);
    if (f == null)
        Debug.crash(new CubesException("Null font"));
    return f;
}
项目:VoiceChat    文件:TestGame.java   
@Override
public void create() {
    try{

        if(true){
            // Run server
            this.server = new Server(22050, 22050);
            server.bind(7777, 7777);
            server.start(); 

            relay = new VoiceChatServer(server.getKryo());

            server.addListener(new Listener(){
                public void received(Connection connection, Object object) {
                    relay.relayVoice(connection, object, server);
                }                   
            });
        }

        this.client = new Client(22050, 22050);
        client.start();
        client.connect(5000, "localhost", 7777, 7777);

        this.sender = new VoiceChatClient(client.getKryo());
        this.sender.addReceiver(client);


    }catch(Exception e){
        e.printStackTrace();
        Gdx.app.exit();
    }   


    // Other stuff for test
    batch = new SpriteBatch();
    font = new BitmapFont();
}
项目:Particles    文件:ParticleGame.java   
/**
 * Called when the {@link Application} is first created.
 */
@Override
public void create() {
    batch = new SpriteBatch();
    font = new BitmapFont();
    multiplexer = new InputMultiplexer();
    game_setup_screen = new GameSetupScreen(this);
    game_screen = new GameScreen(this);
    choice_screen = new ParticleChoiceScreen(this, game_screen);

    Gdx.input.setInputProcessor(multiplexer);
    setScreen(new IntroScreen(this));
}
项目:summer17-android    文件:PlayScreen.java   
public PlayScreen(NoObjectionGame game) {
    atlas = new TextureAtlas("dudestuff3.pack");

    this.game = game;
    bg = new Texture("main_background.png");
    gameCam = new OrthographicCamera();
    gamePort = new FitViewport(NoObjectionGame.V_WIDTH / NoObjectionGame.PPM, NoObjectionGame.V_HEIGHT / NoObjectionGame.PPM, gameCam);
    hud = new Hud(game.batch);

    maploader = new TmxMapLoader();
    map = maploader.load("map1.tmx");
    renderer = new OrthoCachedTiledMapRenderer(map, 1 / NoObjectionGame.PPM);
    gameCam.position.set(gamePort.getWorldWidth() / 2, gamePort.getWorldHeight() / 2, 0);

    world = new World(new Vector2(0, -10), true);
    b2dr = new Box2DDebugRenderer();

    new B2WorldCreator(world, map);
    hero = new Hero(world, this);
    controller = new Controller();
    worldContactListener = new WorldContactListener();
    world.setContactListener(worldContactListener);

    //timer
    sb = new SpriteBatch();
    viewport = new FitViewport(NoObjectionGame.V_WIDTH, NoObjectionGame.V_HEIGHT, new OrthographicCamera());
    stage = new Stage(viewport, sb);
    table = new Table();
    table.top();
    table.setFillParent(true);
    countDownLabel = new Label(Float.toString(playTime), new Label.LabelStyle(new BitmapFont(), Color.WHITE));
    table.add(countDownLabel).expandX();
    stage.addActor(table);


}
项目:arcadelegends-gg    文件:LevelScreen.java   
@Override
public void show() {
    if (arcadeWorld == null || reInit) {
        AL.getAudioManager().registerSound("sword_1", levelAssets.sword_1);
        AL.getAudioManager().registerSound("sword_2", levelAssets.sword_2);
        AL.getAudioManager().registerSound("sword_3", levelAssets.sword_3);
        AL.getAudioManager().registerSound("sword_4", levelAssets.sword_4);
        AL.getAudioManager().registerSound("rocketlauncher", levelAssets.rocketLauncher);
        AL.getAudioManager().registerSound("boom", levelAssets.boom);
        spriteBatch = new SpriteBatch();
        font = new BitmapFont();

        camera = new PerspectiveCamera();
        camera.far = 1000;
        camera.position.set(new Vector3(-.5f, -.5f, 35));
        camera.rotateAround(new Vector3(-.5f, -.5f, 0), Vector3.X, rot);
        camera.fieldOfView = 15;
        camera.update();
        viewport = new ExtendViewport(1920, 1080, camera);
        viewport.apply();
        uiCamera = new OrthographicCamera();
        uiViewport = new FitViewport(1920, 1080, uiCamera);
        uiStage = new Stage(uiViewport);

        map = levelAssets.get(mapName);

        arcadeWorld = new ArcadeWorld(map, rot, camera, levelAssets);

        initUI();

        reInit = false;
        playerEnt = -1;

        spawnPlayer();
        enemies = arcadeWorld.spawnEnemies(playerEnt);
        arcadeWorld.setDebug(AL.getMiscellaneousConfig().debug());
    }

    Gdx.input.setInputProcessor(this);
}