de.lessvoid.nifty.elements.render.TextRenderer Java Examples

The following examples show how to use de.lessvoid.nifty.elements.render.TextRenderer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BattlefieldGUIController.java    From OpenRTS with MIT License 6 votes vote down vote up
@Override
public void update() {
	if(!nifty.isActive("interface/screen.xml", "hud")) {
		return;
	}
	String n = System.getProperty("line.separator");

	// update info
	if (CommandManager.selection.size() == 1) {
		Unit u = CommandManager.selection.get(0);
		getElement("unitName").getRenderer(TextRenderer.class).setText(Reporter.getName(u));
		getElement("unitHealth").getRenderer(TextRenderer.class).setText(Reporter.getHealth(u));
		getElement("unitState").getRenderer(TextRenderer.class).setText(Reporter.getState(u));
		getElement("unitOrder").getRenderer(TextRenderer.class).setText(Reporter.getOrder(u));
		getElement("unitHolding").getRenderer(TextRenderer.class).setText(Reporter.getHolding(u));
		getElement("info").show();
	} else {
		getElement("info").hide();
	}


}
 
Example #2
Source File: GUIDrawer.java    From OpenRTS with MIT License 5 votes vote down vote up
protected void changeLabelText(String id, String text){
    Element e = guiCtrl.getElement(id);
    if(e == null || e.getRenderer(TextRenderer.class) == null)
        throw new IllegalArgumentException("can't find label '"+id+"'.");
    
    e.getRenderer(TextRenderer.class).setText(text);
}
 
Example #3
Source File: GUIDrawer.java    From OpenRTS with MIT License 5 votes vote down vote up
protected void changeButtonTextColor(String id, Color color){
    float a = color.getAlpha();
    float r = color.getRed();
    float g = color.getGreen();
    float b = color.getBlue();
    de.lessvoid.nifty.tools.Color niftyColor = new de.lessvoid.nifty.tools.Color(r/255, g/255, b/255, 1);
    Element e = guiCtrl.getElement(id+"#text");
    if(e == null || e.getRenderer(TextRenderer.class) == null)
        throw new IllegalArgumentException("can't find button's text '"+id+"'.");
    e.getRenderer(TextRenderer.class).setColor(niftyColor);
}
 
Example #4
Source File: SubtitleTrack.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void onPlay() {
    super.onPlay();
    nifty.getScreen(screen).findElementById("text")
            .getRenderer(TextRenderer.class).setText(text);
}
 
Example #5
Source File: GUIDrawer.java    From OpenRTS with MIT License 4 votes vote down vote up
protected void changeButtonText(String id, String text){
    Element e = guiCtrl.getElement(id+"#text");
    if(e == null || e.getRenderer(TextRenderer.class) == null)
        throw new IllegalArgumentException("can't find button's text '"+id+"'.");
    e.getRenderer(TextRenderer.class).setText(text);
}
 
Example #6
Source File: SubtitleTrack.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public void onPlay() {
    super.onPlay();
    nifty.getScreen(screen).findElementByName("text").getRenderer(TextRenderer.class).setText(text);
}