Corrections
Some checks failed
EpicKnarvik97/Rogue101/master There was a failure building this commit
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:
parent
de0924845d
commit
38de5952ad
14
pom.xml
14
pom.xml
@ -26,6 +26,16 @@
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-base</artifactId>
|
||||
<version>12</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-graphics</artifactId>
|
||||
<version>12</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-controls</artifactId>
|
||||
@ -58,7 +68,7 @@
|
||||
<manifest>
|
||||
<addClasspath>true</addClasspath>
|
||||
<classpathPrefix>lib/</classpathPrefix>
|
||||
<mainClass>inf101.v18.rogue101.Main</mainClass>
|
||||
<mainClass>inf101.v18.rogue101.Launcher</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
@ -70,7 +80,7 @@
|
||||
<archive>
|
||||
<manifest>
|
||||
<addClasspath>true</addClasspath>
|
||||
<mainClass>inf101.v18.rogue101.Main</mainClass>
|
||||
<mainClass>inf101.v18.rogue101.Launcher</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
<descriptorRefs>
|
||||
|
@ -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());
|
||||
|
9
src/main/java/inf101/v18/rogue101/Launcher.java
Normal file
9
src/main/java/inf101/v18/rogue101/Launcher.java
Normal file
@ -0,0 +1,9 @@
|
||||
package inf101.v18.rogue101;
|
||||
|
||||
import javafx.application.Application;
|
||||
|
||||
public class Launcher {
|
||||
public static void main(String[] args) {
|
||||
Application.launch(Main.class, args);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user