Verwendung eigener Schriftarten

This commit is contained in:
ngb
2022-07-01 13:00:53 +02:00
parent 57c396c2e4
commit 0f0b03d8fe
5 changed files with 27 additions and 8 deletions

View File

@@ -19,6 +19,7 @@ public class Display extends ShapeGroup {
text.setFontColor(255);
text.setFontsize(20);
text.setAnchor(NORTHWEST);
text.setFont("fonts/FredokaOne-Regular.ttf");
add(background, text);
}

View File

@@ -1,10 +1,9 @@
import schule.ngb.zm.Constants;
import schule.ngb.zm.ImageLayer;
import schule.ngb.zm.Spielemaschine;
import schule.ngb.zm.shapes.Picture;
import schule.ngb.zm.util.FontLoader;
import java.awt.Image;
import java.awt.event.KeyEvent;
import java.awt.Font;
import java.lang.reflect.InvocationTargetException;
public class HehomonGame extends Spielemaschine {
@@ -23,20 +22,39 @@ public class HehomonGame extends Spielemaschine {
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() {
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
public void setup() {
Font font = FontLoader.loadFont("fonts/FredokaOne-Regular.ttf" );
ImageLayer bg = new ImageLayer("images/hintergrund.jpg");
canvas.addLayer(1, bg);
attacker = new Alligung();
attacker = newHehomon();
attacker.moveTo(width * .25, 250);
attacker.flip(LEFT);
defender = new Salamanyte();
defender = newHehomon();
defender.moveTo(width * .75, 250);
hpAttacker = new Hitpoints(attacker);

View File

@@ -17,7 +17,7 @@ public class Menu extends ShapeGroup {
lines = new Text[4];
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].setFontsize(20);
lines[i].setAnchor(NORTHWEST);

Binary file not shown.

Binary file not shown.