1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| public class Help extends BasicGameState{
public Help(int state){}
public int getID() {return 1;}
private UnicodeFont fontTest;
private TextField nomPerso;
private Color colorNomPerso;
public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
fontTest = new UnicodeFont(new java.awt.Font("DejaVu Serif", java.awt.Font.PLAIN, 20));
fontTest.addAsciiGlyphs();
fontTest.addGlyphs(400,600);
fontTest.getEffects().add(new ColorEffect(java.awt.Color.black));
fontTest.loadGlyphs();
}
public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
nomPerso = new TextField(gc, fontTest, 100, 30, 300, 40);
nomPerso.setBackgroundColor(colorNomPerso.white);
nomPerso.setFocus(true);
public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
nomPerso.render(gc, g);
}
} |
Partager