mirror of
https://github.com/jneug/zeichenmaschine.git
synced 2026-04-14 14:43:33 +02:00
Verwendung eigener Schriftarten
This commit is contained in:
@@ -19,6 +19,7 @@ public class Display extends ShapeGroup {
|
|||||||
text.setFontColor(255);
|
text.setFontColor(255);
|
||||||
text.setFontsize(20);
|
text.setFontsize(20);
|
||||||
text.setAnchor(NORTHWEST);
|
text.setAnchor(NORTHWEST);
|
||||||
|
text.setFont("fonts/FredokaOne-Regular.ttf");
|
||||||
|
|
||||||
add(background, text);
|
add(background, text);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import schule.ngb.zm.Constants;
|
|
||||||
import schule.ngb.zm.ImageLayer;
|
import schule.ngb.zm.ImageLayer;
|
||||||
import schule.ngb.zm.Spielemaschine;
|
import schule.ngb.zm.Spielemaschine;
|
||||||
import schule.ngb.zm.shapes.Picture;
|
import schule.ngb.zm.util.FontLoader;
|
||||||
|
|
||||||
import java.awt.Image;
|
import java.awt.Font;
|
||||||
import java.awt.event.KeyEvent;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
public class HehomonGame extends Spielemaschine {
|
public class HehomonGame extends Spielemaschine {
|
||||||
|
|
||||||
@@ -23,20 +22,39 @@ public class HehomonGame extends Spielemaschine {
|
|||||||
|
|
||||||
private boolean idle = true;
|
private boolean idle = true;
|
||||||
|
|
||||||
|
private static final Class[] HEHOMONS = new Class[]{
|
||||||
|
Alligung.class, Salamanyte.class, Gardon.class, Mantairy.class, Shigong.class, Toxo.class, Wokachu.class
|
||||||
|
};
|
||||||
|
|
||||||
public HehomonGame() {
|
public HehomonGame() {
|
||||||
super(960, 642, "ZM: Hehomon");
|
super(960, 642, "ZM: Hehomon");
|
||||||
setFullscreen(true);
|
//setFullscreen(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Hehomon newHehomon() {
|
||||||
|
try {
|
||||||
|
Class<Hehomon> clazz = (Class<Hehomon>) choice(HEHOMONS);
|
||||||
|
return clazz.getConstructor().newInstance();
|
||||||
|
} catch( NoSuchMethodException | InstantiationException |
|
||||||
|
IllegalAccessException | InvocationTargetException ex ) {
|
||||||
|
exit();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setup() {
|
public void setup() {
|
||||||
|
Font font = FontLoader.loadFont("fonts/FredokaOne-Regular.ttf" );
|
||||||
|
|
||||||
ImageLayer bg = new ImageLayer("images/hintergrund.jpg");
|
ImageLayer bg = new ImageLayer("images/hintergrund.jpg");
|
||||||
canvas.addLayer(1, bg);
|
canvas.addLayer(1, bg);
|
||||||
|
|
||||||
attacker = new Alligung();
|
|
||||||
|
|
||||||
|
attacker = newHehomon();
|
||||||
attacker.moveTo(width * .25, 250);
|
attacker.moveTo(width * .25, 250);
|
||||||
attacker.flip(LEFT);
|
attacker.flip(LEFT);
|
||||||
defender = new Salamanyte();
|
defender = newHehomon();
|
||||||
defender.moveTo(width * .75, 250);
|
defender.moveTo(width * .75, 250);
|
||||||
|
|
||||||
hpAttacker = new Hitpoints(attacker);
|
hpAttacker = new Hitpoints(attacker);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class Menu extends ShapeGroup {
|
|||||||
|
|
||||||
lines = new Text[4];
|
lines = new Text[4];
|
||||||
for( int i = 0; i < lines.length; i++ ) {
|
for( int i = 0; i < lines.length; i++ ) {
|
||||||
lines[i] = new Text(5, 5+i*25, "");
|
lines[i] = new Text(5, 5+i*25, "", "Arial-BOLD-20");
|
||||||
lines[i].setFontColor(WHITE);
|
lines[i].setFontColor(WHITE);
|
||||||
lines[i].setFontsize(20);
|
lines[i].setFontsize(20);
|
||||||
lines[i].setAnchor(NORTHWEST);
|
lines[i].setAnchor(NORTHWEST);
|
||||||
|
|||||||
BIN
examples/zm_hehomon/fonts/FredokaOne-Regular.ttf
Executable file
BIN
examples/zm_hehomon/fonts/FredokaOne-Regular.ttf
Executable file
Binary file not shown.
BIN
examples/zm_hehomon/music/Water-Balloon-Maniacs.mp3
Executable file
BIN
examples/zm_hehomon/music/Water-Balloon-Maniacs.mp3
Executable file
Binary file not shown.
Reference in New Issue
Block a user