Integrated res folder into JAR

This commit is contained in:
Kai S. K. Engelbart 2019-07-16 18:47:26 +02:00
parent 2108ea7280
commit e092f43fb5
Signed by: kske
GPG Key ID: 8BEB13EC5DF7EF13
2 changed files with 2 additions and 3 deletions

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="res"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes> <attributes>
<attribute name="module" value="true"/> <attribute name="module" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="lib" path="res"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View File

@ -2,7 +2,6 @@ package dev.kske.minesweeper;
import java.awt.Image; import java.awt.Image;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
@ -28,7 +27,7 @@ public class TextureLoader {
public static Image loadScaledImage(String name, int scale) { public static Image loadScaledImage(String name, int scale) {
BufferedImage in = null; BufferedImage in = null;
try { try {
in = ImageIO.read(new File("res" + File.separator + name + ".png")); in = ImageIO.read(TextureLoader.class.getResourceAsStream("/" + name + ".png"));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }