List of usage examples for com.badlogic.gdx.graphics.g2d BitmapFontCache setMultiLineText
public TextBounds setMultiLineText(CharSequence str, float x, float y)
From source file:com.digitale.sim.Simulation.java
License:Open Source License
public static void updateActorFontCache() { String currentName;// w w w.j a v a2 s. c o m // Renderer.actorNames.clear(); // for every actor for (int i = 0; i < Stardust3d.actorsList.size(); i++) { // is it renderable? Actor actor = Stardust3d.actorsList.get(i); if (actor != null && !(actor.shipname.equals("dead")) && actor.getHitpoints() > 0) { // only do if actor is in space currentName = actor.get_firstname() + "\n" + actor.get_surname(); if (actor.visible) { actor.cache = new BitmapFontCache(Renderer.fontsmall); actor.cache.setText(actor.distanceString, 0, 0); boolean found = false; for (int j = 0; j < Renderer.actorNames.size(); j++) { ActorNameCache actorName = Renderer.actorNames.get(j); if ((actorName.getName().equals(currentName))) { found = true; } else { } } if (found == false) { BitmapFontCache tempBMFC = new BitmapFontCache(Renderer.fontsmall); tempBMFC.setMultiLineText(actor.get_firstname() + "\n" + actor.get_surname(), 0, 0); tempBMFC.setColor(0, 1, 0, 1); if (actor.getShipname().equals("aiscout")) { tempBMFC.setColor(1, 0, 0, 1); } else if (actor.getShipname().equals("shielddisruptor")) { tempBMFC.setColor(1, .75f, 0, 1); } Renderer.actorNames.add(new ActorNameCache(tempBMFC, currentName)); } } } } }
From source file:com.ridiculousRPG.ui.DisplayPlainTextService.java
License:Apache License
private BitmapFontCache createMsg(CharSequence text, float color, float x, float y, float wrapWidth) { BitmapFontCache bfc = fontCachePool.obtain(font); bfc.setColor(color);// w ww. ja v a 2 s .c o m if (wrapWidth > 0f) bfc.setWrappedText(text, x, y, wrapWidth); else bfc.setMultiLineText(text, x, y); return bfc; }