|
12 | 12 | import java.io.PrintStream; |
13 | 13 | import java.nio.FloatBuffer; |
14 | 14 |
|
| 15 | +import com.etheller.warsmash.WarsmashGdxMapScreen; |
| 16 | +import com.etheller.warsmash.datasources.DataSource; |
15 | 17 | import org.lwjgl.BufferUtils; |
16 | 18 | import org.lwjgl.openal.AL; |
17 | 19 | import org.lwjgl.opengl.GL11; |
|
45 | 47 |
|
46 | 48 | public class DesktopLauncher { |
47 | 49 | public static void main(final String[] arg) { |
48 | | - System.out.println("You ran it."); |
| 50 | + System.out.println("You ran it in working directory " + System.getProperty("user.dir")); |
49 | 51 | final LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); |
50 | 52 | config.useGL30 = true; |
51 | 53 | config.gles30ContextMajorVersion = 3; |
52 | 54 | config.gles30ContextMinorVersion = 3; |
53 | 55 | // config.samples = 16; |
54 | 56 | // config.vSyncEnabled = false; |
55 | | - config.addIcon("resources/Icon16.png", Files.FileType.Internal); |
56 | | - config.addIcon("resources/Icon32.png", Files.FileType.Internal); |
57 | | - config.addIcon("resources/Icon64.png", Files.FileType.Internal); |
58 | | - config.addIcon("resources/Icon128.png", Files.FileType.Internal); |
59 | 57 | // config.foregroundFPS = 0; |
60 | 58 | // config.backgroundFPS = 0; |
61 | 59 | final DisplayMode desktopDisplayMode = LwjglApplicationConfiguration.getDesktopDisplayMode(); |
@@ -100,7 +98,26 @@ else if ((arg.length > (argIndex + 1)) && "-ini".equals(arg[argIndex])) { |
100 | 98 | } |
101 | 99 | loadExtensions(); |
102 | 100 | final DataTable warsmashIni = loadWarsmashIni(iniPath); |
| 101 | + |
| 102 | + // Load icons: |
| 103 | + DataSource codebase = WarsmashGdxMapScreen.parseDataSources(warsmashIni); |
| 104 | + try { |
| 105 | + config.addIcon(codebase.getFile("resources/Icon16.png").getAbsolutePath(), Files.FileType.Internal); |
| 106 | + config.addIcon(codebase.getFile("resources/Icon32.png").getAbsolutePath(), Files.FileType.Internal); |
| 107 | + config.addIcon(codebase.getFile("resources/Icon64.png").getAbsolutePath(), Files.FileType.Internal); |
| 108 | + config.addIcon(codebase.getFile("resources/Icon128.png").getAbsolutePath(), Files.FileType.Internal); |
| 109 | + } catch (final IOException e) { |
| 110 | + e.printStackTrace(); |
| 111 | + } |
| 112 | + |
103 | 113 | final Element emulatorConstants = warsmashIni.get("Emulator"); |
| 114 | + |
| 115 | + if (emulatorConstants == null) { |
| 116 | + System.err.println("Missing entry \"Emulator\" in .ini file."); |
| 117 | + |
| 118 | + return; |
| 119 | + } |
| 120 | + |
104 | 121 | WarsmashConstants.loadConstants(emulatorConstants, warsmashIni); |
105 | 122 |
|
106 | 123 | if (fileToLoad != null) { |
|
0 commit comments