Corrections
Some checks failed
EpicKnarvik97/Rogue101/master There was a failure building this commit

Moves fonts to correct directory
Adds missing dependencies
Adds a launcher for better stability
This commit is contained in:
2020-02-14 21:30:48 +01:00
parent de0924845d
commit 38de5952ad
11 changed files with 25 additions and 4 deletions

View File

@ -18,6 +18,7 @@ import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
import javafx.scene.shape.StrokeLineCap;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.transform.Affine;
import javafx.scene.transform.Transform;
@ -55,7 +56,7 @@ public class TextFont {
public static final int ATTR_FAINT = 0x400; // NOT IMPLEMENTED
public static final int ATTR_BRIGHT = 0x800;
private static final String[] searchPath = { "", "../", "../fonts/" };
private static final String[] searchPath = { "", "../", "fonts/" };
private static final Map<String, String> loadedFonts = new HashMap<>();
private static final double thin = 2.0, thick = 4.0;
private static final String[] boxDrawingShapes = { // lines
@ -202,7 +203,8 @@ public class TextFont {
return Font.font(loadedFonts.get(name), size);
for (String path : searchPath) {
try (InputStream stream = clazz.getResourceAsStream(path + name)) {
ClassLoader classloader = Thread.currentThread().getContextClassLoader();
try (InputStream stream = classloader.getResourceAsStream(path + name)) {
Font font = Font.loadFont(stream, size);
if (font != null) {
loadedFonts.put(name, font.getName());