Example usage for com.badlogic.gdx.graphics.g2d BitmapFontCache setColor

List of usage examples for com.badlogic.gdx.graphics.g2d BitmapFontCache setColor

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.g2d BitmapFontCache setColor.

Prototype

public void setColor(float r, float g, float b, float a) 

Source Link

Document

Sets the color of subsequently added text.

Usage

From source file:com.digitale.sim.Simulation.java

License:Open Source License

public static void updateActorFontCache() {
    String currentName;/* w ww.jav a 2  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));

                }
            }
        }
    }
}