mirror of
https://github.com/jneug/zeichenmaschine.git
synced 2026-10-12 09:56:33 +02:00
Hehomon Beispiel implementiert
Noch Bugs bei Verwendung des Vollbildmodus vorhanden
This commit is contained in:
40
examples/zm_hehomon/Menu.java
Executable file
40
examples/zm_hehomon/Menu.java
Executable file
@@ -0,0 +1,40 @@
|
||||
import schule.ngb.zm.shapes.Rectangle;
|
||||
import schule.ngb.zm.shapes.ShapeGroup;
|
||||
import schule.ngb.zm.shapes.Text;
|
||||
|
||||
public class Menu extends ShapeGroup {
|
||||
|
||||
private Rectangle background;
|
||||
|
||||
private Text[] lines;
|
||||
|
||||
public Menu( Hehomon pHehomon ) {
|
||||
super(0, 0);
|
||||
|
||||
background = new Rectangle(0, 0, 400, 110);
|
||||
background.setFillColor(0, 133);
|
||||
add(background);
|
||||
|
||||
lines = new Text[4];
|
||||
for( int i = 0; i < lines.length; i++ ) {
|
||||
lines[i] = new Text(5, 5+i*25, "");
|
||||
lines[i].setFontColor(WHITE);
|
||||
lines[i].setFontsize(20);
|
||||
lines[i].setAnchor(NORTHWEST);
|
||||
}
|
||||
add(lines);
|
||||
|
||||
setText(0, pHehomon.getNameAngr1());
|
||||
setText(1, pHehomon.getNameAngr2());
|
||||
setText(2, pHehomon.getNameVert1());
|
||||
setText(3, pHehomon.getNameVert2());
|
||||
}
|
||||
|
||||
public void setText( int pLineNumber, String pText ) {
|
||||
if( pLineNumber < lines.length && pLineNumber >= 0 ) {
|
||||
char button = new char[]{'A', 'S', 'D', 'F'}[pLineNumber];
|
||||
lines[pLineNumber].setText(button + ": " + pText);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user