1 /* 2 * To change this template, choose Tools | Templates 3 * and open the template in the editor. 4 */ 5 6 package jme3test.animation; 7 8 import com.jme3.cinematic.events.GuiTrack; 9 import de.lessvoid.nifty.Nifty; 10 import de.lessvoid.nifty.elements.render.TextRenderer; 11 12 /** 13 * 14 * @author Nehon 15 */ 16 public class SubtitleTrack extends GuiTrack{ 17 private String text=""; 18 SubtitleTrack(Nifty nifty, String screen,float initialDuration, String text)19 public SubtitleTrack(Nifty nifty, String screen,float initialDuration, String text) { 20 super(nifty, screen, initialDuration); 21 this.text=text; 22 } 23 24 @Override onPlay()25 public void onPlay() { 26 super.onPlay(); 27 nifty.getScreen(screen).findElementByName("text").getRenderer(TextRenderer.class).setText(text); 28 } 29 30 31 32 33 34 35 36 37 } 38