this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

bootstrap + WIP import rework

clover ffbc6922 58fc2f4d

+402 -55
+3 -12
.classpath
··· 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <classpath> 3 - <classpathentry kind="src" output="bin/main" path="src/main/resources"> 4 - <attributes> 5 - <attribute name="gradle_scope" value="main"/> 6 - <attribute name="gradle_used_by_scope" value="main,test"/> 7 - </attributes> 8 - </classpathentry> 9 - <classpathentry kind="src" output="bin/main" path="src/main/java"> 10 - <attributes> 11 - <attribute name="gradle_scope" value="main"/> 12 - <attribute name="gradle_used_by_scope" value="main,test"/> 13 - </attributes> 14 - </classpathentry> 3 + <classpathentry kind="src" output="bin/main" path="src/main/resources"/> 4 + <classpathentry kind="src" output="bin/main" path="src/main/java"/> 5 + <classpathentry kind="src" path="src/bootstrap/java"/> 15 6 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/> 16 7 <classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/> 17 8 <classpathentry kind="output" path="bin/default"/>
+56 -15
build.gradle.kts
··· 5 5 file("app.properties").inputStream().use { load(it) } 6 6 } 7 7 8 + val bootMain = "boot.StarRodBootstrap" 8 9 val appMain = "app.StarRodMain" 9 10 val appVersion = appProperties.getProperty("version") 10 11 ··· 16 17 id("java") 17 18 id("com.github.johnrengelman.shadow") version "8.1.1" 18 19 id("net.nemerosa.versioning") version "3.1.0" 19 - id("com.jaredsburrows.license") version "0.9.7" 20 + id("com.cmgapps.licenses") version "4.8.0" 20 21 } 21 22 22 23 java { 23 - sourceCompatibility = JavaVersion.VERSION_17 24 - targetCompatibility = JavaVersion.VERSION_17 24 + toolchain { 25 + languageVersion.set(JavaLanguageVersion.of(17)) 26 + } 25 27 } 26 28 27 29 dependencies { ··· 93 95 implementation("org.ahocorasick:ahocorasick:0.6.3") 94 96 } 95 97 98 + 99 + val bootBuildDir = layout.buildDirectory.dir("bootstrap") 100 + val appBuildDir = layout.buildDirectory.dir("app") 101 + val licenseBuildDir = layout.buildDirectory.dir("reports/licenses/licenseReport") 102 + val releaseBuildDir = layout.buildDirectory.dir("release") 103 + 96 104 tasks { 105 + val compileBoot = register<JavaCompile>("compileBoot") { 106 + source = fileTree("src/bootstrap/java") 107 + destinationDirectory.set(bootBuildDir.get().asFile) 108 + classpath = files() // use empty classpath since there are no dependencies 109 + options.release.set(8) 110 + } 111 + 112 + val jarBoot = register<Jar>("jarBoot") { 113 + dependsOn(compileBoot) 114 + archiveBaseName.set("boot") 115 + manifest { 116 + attributes["Main-Class"] = bootMain 117 + } 118 + from(bootBuildDir) 119 + } 120 + 121 + val compileApp = register<JavaCompile>("compileApp") { 122 + source = fileTree("src/main/java") 123 + destinationDirectory.set(appBuildDir.get().asFile) 124 + classpath = sourceSets.main.get().compileClasspath // use the default classpath 125 + options.release.set(17) 126 + options.compilerArgs.add("-Xlint:deprecation") 127 + } 128 + 129 + val jarApp = register<Jar>("jarApp") { 130 + dependsOn(compileApp) 131 + archiveBaseName.set("main-app") 132 + manifest { 133 + attributes["Main-Class"] = appMain 134 + } 135 + from(appBuildDir) 136 + } 137 + 97 138 shadowJar { 139 + dependsOn(jarBoot, jarApp) 140 + 141 + from(bootBuildDir, appBuildDir) 142 + 98 143 mergeServiceFiles("META-INF/spring.*") 99 144 exclude("META-INF/*.SF") 100 145 exclude("META-INF/*.DSA") ··· 103 148 archiveFileName.set("StarRod.jar") 104 149 105 150 manifest { 106 - attributes["Main-Class"] = "$appMain" 107 - attributes["App-Version"] = "$appVersion" 151 + attributes["Main-Class"] = bootMain 152 + attributes["App-Version"] = appVersion 108 153 attributes["Build-Branch"] = versioning.info.branchId 109 154 attributes["Build-Commit"] = versioning.info.commit 110 155 if (versioning.info.tag != null) ··· 112 157 } 113 158 } 114 159 115 - register("createReleaseZip", Zip::class) { 160 + register<Zip>("createReleaseZip") { 161 + dependsOn(clean, licenseReport, shadowJar) 162 + 116 163 group = "release" 117 164 description = "Create zip file for Star Rod release" 118 165 ··· 122 169 into("database") 123 170 } 124 171 125 - from(file(layout.buildDirectory.dir("reports"))) { 126 - into("database") 172 + from(file(licenseBuildDir)) { 173 + into("database/licenses") 127 174 } 128 175 129 176 from(file("exec")) { ··· 141 188 } 142 189 ) 143 190 144 - destinationDirectory.set(layout.buildDirectory.dir("release")) 145 - } 146 - 147 - named("createReleaseZip") { 148 - dependsOn("clean") 149 - dependsOn("shadowJar") 150 - dependsOn("licenseReport") 191 + destinationDirectory.set(releaseBuildDir) 151 192 } 152 193 }
+127
src/bootstrap/java/boot/StarRodBootstrap.java
··· 1 + package boot; 2 + 3 + import java.awt.Desktop; 4 + import java.awt.GraphicsEnvironment; 5 + import java.net.URI; 6 + 7 + import javax.swing.JOptionPane; 8 + 9 + public class StarRodBootstrap 10 + { 11 + public static void main(String[] args) 12 + { 13 + boolean isCommandLine = args.length > 0 || GraphicsEnvironment.isHeadless(); 14 + 15 + String version = System.getProperty("java.version"); 16 + if (getMajorVersion(version) < 17) { 17 + showDownloadMessage(isCommandLine, version); 18 + System.exit(-1); 19 + } 20 + 21 + try { 22 + launchApp(isCommandLine, args); 23 + } 24 + catch (Exception e) { 25 + System.err.println("Exception during bootstrap: " + e.getMessage()); 26 + e.printStackTrace(); 27 + } 28 + } 29 + 30 + private static int getMajorVersion(String version) 31 + { 32 + String[] parts = version.split("\\."); 33 + if (parts[0].equals("1")) { 34 + // Java 8 or earlier: format "1.x" 35 + return Integer.parseInt(parts[1]); 36 + } 37 + else { 38 + // Java 9 or later: format "x" 39 + return Integer.parseInt(parts[0]); 40 + } 41 + } 42 + 43 + private static void launchApp(boolean isCommandLine, String[] args) throws Exception 44 + { 45 + String javaHome = System.getProperty("java.home"); 46 + String javaExec = javaHome + "/bin/java"; 47 + 48 + String jarPath = StarRodBootstrap.class 49 + .getProtectionDomain() 50 + .getCodeSource() 51 + .getLocation() 52 + .toURI() 53 + .getPath(); 54 + 55 + ProcessBuilder processBuilder; 56 + if (args.length > 0) { 57 + processBuilder = new ProcessBuilder( 58 + javaExec, 59 + "-cp", 60 + jarPath, 61 + "app.StarRodMain", 62 + String.join(" ", args).trim()); 63 + } 64 + else { 65 + processBuilder = new ProcessBuilder( 66 + javaExec, 67 + "-cp", 68 + jarPath, 69 + "app.StarRodMain"); 70 + } 71 + 72 + processBuilder.inheritIO(); 73 + Process process = processBuilder.start(); 74 + process.waitFor(); 75 + } 76 + 77 + private static void showDownloadMessage(boolean isCommandLine, String version) 78 + { 79 + String downloadUrl = "https://www.oracle.com/java/technologies/downloads/"; 80 + 81 + if (isCommandLine) { 82 + System.out.println("Java 17 or later is required to run this application."); 83 + System.out.println("Your current version: " + version); 84 + System.out.println("Download the latest version from:"); 85 + System.out.println(downloadUrl); 86 + } 87 + else { 88 + 89 + String errorMsg = "<html><body>" 90 + + "Java 17 or later is required to run this application.<br>" 91 + + "Your current version: <b>" + version + "</b><br><br>" 92 + + "Download the latest version from:<br>" 93 + + "<a href='" + downloadUrl + "'>" + downloadUrl + "</a>" 94 + + "</body></html>"; 95 + 96 + int result = JOptionPane.showOptionDialog( 97 + null, 98 + errorMsg, 99 + "Java Version Error", 100 + JOptionPane.DEFAULT_OPTION, 101 + JOptionPane.ERROR_MESSAGE, 102 + null, 103 + new String[] { "Open Link", "Close" }, 104 + "Open Link" 105 + ); 106 + 107 + if (result == 0) { 108 + openLink(downloadUrl); 109 + } 110 + } 111 + } 112 + 113 + private static void openLink(String url) 114 + { 115 + try { 116 + if (Desktop.isDesktopSupported()) { 117 + Desktop.getDesktop().browse(new URI(url)); 118 + } 119 + else { 120 + System.err.println("Desktop is not supported. Open this link manually: " + url); 121 + } 122 + } 123 + catch (Exception e) { 124 + System.err.println("Failed to open link: " + e.getMessage()); 125 + } 126 + } 127 + }
+1 -1
src/main/java/app/StarRodMain.java
··· 585 585 break; 586 586 587 587 default: 588 - Logger.logfError("Unrecognized command line arg: ", args[i]); 588 + Logger.logfError("Unrecognized command line arg: %s", args[i]); 589 589 } 590 590 } 591 591 }
-1
src/main/java/common/BaseEditor.java
··· 52 52 import common.KeyboardInput.KeyboardInputListener; 53 53 import common.MouseInput.MouseManagerListener; 54 54 import game.map.editor.CommandManager; 55 - import game.map.editor.GLEditor; 56 55 import game.map.editor.Tickable; 57 56 import game.map.editor.commands.AbstractCommand; 58 57 import net.miginfocom.swing.MigLayout;
+1 -1
src/main/java/game/ProjectDatabase.java
··· 50 50 decompEnums = new CaseInsensitiveMap<>(); 51 51 DecompEnum.addEnums(decompEnums, Directories.PROJ_INCLUDE.file("enums.h").getAbsolutePath()); 52 52 DecompEnum.addEnums(decompEnums, Directories.PROJ_INCLUDE.file("effects.h").getAbsolutePath()); 53 - DecompEnum.addEnums(decompEnums, Directories.PROJ_SRC.file("battle/formation_names.h").getAbsolutePath()); 53 + DecompEnum.addEnums(decompEnums, Directories.PROJ_SRC.file("battle/battle_names.h").getAbsolutePath()); 54 54 DecompEnum.addEnums(decompEnums, Directories.PROJ_SRC.file("battle/stage_names.h").getAbsolutePath()); 55 55 56 56 ESurfaceTypes = decompEnums.get("SurfaceType");
+1 -1
src/main/java/game/map/editor/EditorCanvas.java src/main/java/common/EditorCanvas.java
··· 1 - package game.map.editor; 1 + package common; 2 2 3 3 import static org.lwjgl.opengl.GL.createCapabilities; 4 4 import static org.lwjgl.opengl.GL11.GL_VERSION;
+1 -1
src/main/java/game/map/editor/GLEditor.java src/main/java/common/GLEditor.java
··· 1 - package game.map.editor; 1 + package common; 2 2 3 3 import java.awt.Window; 4 4
+2 -1
src/main/java/game/map/editor/MapEditor.java
··· 53 53 import assets.ui.SelectMapDialog; 54 54 import assets.ui.SelectTexDialog; 55 55 import common.FrameLimiter; 56 + import common.GLEditor; 56 57 import common.KeyboardInput; 57 58 import common.KeyboardInput.KeyInputEvent; 58 59 import common.KeyboardInput.KeyboardInputListener; ··· 183 184 184 185 private boolean loading = true; 185 186 private boolean exitCompletely = !Environment.mainConfig.getBoolean(Options.ExitToMenu); 187 + private boolean showLoadingScreen; 186 188 187 189 public boolean needsTextureReload; 188 190 public boolean needsBackgroundReload; ··· 451 453 private CommandManager commandManager; // handles comnmand execution and undo/redo 452 454 private DrawTrianglesManager drawTriManager; 453 455 public SwingGUI gui; 454 - private boolean showLoadingScreen; 455 456 456 457 public boolean showLightingPanel; 457 458 public boolean showMapCameraTab;
+30 -19
src/main/java/game/map/editor/camera/OrthographicCamera.java
··· 279 279 } 280 280 } 281 281 282 + @Override 283 + public void drawBackground() 284 + { 285 + if (editor.gridEnabled) 286 + drawGrid(); 287 + 288 + if (editor.showAxes) 289 + drawAxes(); 290 + 291 + if (editor.gridEnabled || editor.showAxes) { 292 + RenderState.setDepthWrite(false); 293 + LineRenderQueue.render(true); 294 + RenderState.setDepthWrite(true); 295 + } 296 + } 297 + 282 298 /** 283 299 * Draw the grid in the background. 284 300 */ 285 - @Override 286 - public void drawBackground() 301 + public void drawGrid() 287 302 { 288 303 int hmin = 0, hmax = 0; 289 304 int vmin = 0, vmax = 0; ··· 393 408 } 394 409 } 395 410 396 - if (editor.showAxes) { 397 - LineRenderQueue.addLine( 398 - LineRenderQueue.addVertex().setPosition(Short.MIN_VALUE, 0, 0).setColor(PresetColor.RED).getIndex(), 399 - LineRenderQueue.addVertex().setPosition(Short.MAX_VALUE, 0, 0).setColor(PresetColor.RED).getIndex()); 400 - 401 - LineRenderQueue.addLine( 402 - LineRenderQueue.addVertex().setPosition(0, Short.MIN_VALUE, 0).setColor(PresetColor.GREEN).getIndex(), 403 - LineRenderQueue.addVertex().setPosition(0, Short.MAX_VALUE, 0).setColor(PresetColor.GREEN).getIndex()); 404 - 405 - LineRenderQueue.addLine( 406 - LineRenderQueue.addVertex().setPosition(0, 0, Short.MIN_VALUE).setColor(PresetColor.BLUE).getIndex(), 407 - LineRenderQueue.addVertex().setPosition(0, 0, Short.MAX_VALUE).setColor(PresetColor.BLUE).getIndex()); 408 - } 409 - 410 411 RenderState.setLineWidth(2.0f); 411 412 RenderState.setColor(0.35f, 0.35f, 0.35f, 1.0f); 412 413 int v1, v2, v3, v4; ··· 440 441 default: 441 442 break; 442 443 } 444 + } 443 445 444 - RenderState.setDepthWrite(false); 445 - LineRenderQueue.render(true); 446 - RenderState.setDepthWrite(true); 446 + public void drawAxes() 447 + { 448 + LineRenderQueue.addLine( 449 + LineRenderQueue.addVertex().setPosition(Short.MIN_VALUE, 0, 0).setColor(PresetColor.RED).getIndex(), 450 + LineRenderQueue.addVertex().setPosition(Short.MAX_VALUE, 0, 0).setColor(PresetColor.RED).getIndex()); 447 451 452 + LineRenderQueue.addLine( 453 + LineRenderQueue.addVertex().setPosition(0, Short.MIN_VALUE, 0).setColor(PresetColor.GREEN).getIndex(), 454 + LineRenderQueue.addVertex().setPosition(0, Short.MAX_VALUE, 0).setColor(PresetColor.GREEN).getIndex()); 455 + 456 + LineRenderQueue.addLine( 457 + LineRenderQueue.addVertex().setPosition(0, 0, Short.MIN_VALUE).setColor(PresetColor.BLUE).getIndex(), 458 + LineRenderQueue.addVertex().setPosition(0, 0, Short.MAX_VALUE).setColor(PresetColor.BLUE).getIndex()); 448 459 } 449 460 450 461 @Override
+1 -2
src/main/java/game/map/editor/camera/OrthographicViewport.java
··· 112 112 camera.glLoadTransform(); 113 113 RenderState.setModelMatrix(null); 114 114 115 - if (editor.gridEnabled) 116 - camera.drawBackground(); 115 + camera.drawBackground(); 117 116 118 117 Map shapeMap = editor.getGeometryMap(); 119 118 Map hitMap = editor.getCollisionMap();
+1 -1
src/main/java/game/map/editor/ui/SwingGUI.java
··· 57 57 import assets.ui.SelectBackgroundDialog; 58 58 import assets.ui.SelectMapDialog; 59 59 import assets.ui.SelectTexDialog; 60 + import common.EditorCanvas; 60 61 import game.ProjectDatabase; 61 62 import game.map.Map; 62 63 import game.map.Map.SetBackground; ··· 64 65 import game.map.Map.ToggleStage; 65 66 import game.map.MapObject; 66 67 import game.map.MapObject.MapObjectType; 67 - import game.map.editor.EditorCanvas; 68 68 import game.map.editor.EditorShortcut; 69 69 import game.map.editor.MapEditor; 70 70 import game.map.editor.MapEditor.EditorMode;
+82
src/main/java/game/map/impex/ExportDialog.java
··· 1 + package game.map.impex; 2 + 3 + import java.awt.event.WindowEvent; 4 + import java.io.File; 5 + 6 + import javax.swing.JButton; 7 + import javax.swing.JCheckBox; 8 + import javax.swing.JComboBox; 9 + import javax.swing.JDialog; 10 + import javax.swing.JFrame; 11 + import javax.swing.JLabel; 12 + import javax.swing.JPanel; 13 + import javax.swing.WindowConstants; 14 + 15 + import app.Environment; 16 + import app.SwingUtils; 17 + import game.map.editor.ui.dialogs.SaveFileChooser; 18 + import net.miginfocom.swing.MigLayout; 19 + 20 + public class ExportDialog extends JDialog 21 + { 22 + public static final String FRAME_TITLE = "Export"; 23 + 24 + private JComboBox<ImpexFormat> fileTypeComboBox; 25 + private JCheckBox cbSelectedOnly; 26 + 27 + public ExportDialog(JFrame parent) 28 + { 29 + super(parent); 30 + 31 + JButton selectButton = new JButton("Export"); 32 + SwingUtils.addBorderPadding(selectButton); 33 + selectButton.addActionListener((e) -> { 34 + 35 + File mapDir = Environment.getProjectDirectory(); 36 + SaveFileChooser chooser = new SaveFileChooser(mapDir, "Export Geometry", 37 + "Exportables", "obj", "fbx", "prefab"); 38 + 39 + //TODO select file 40 + setVisible(false); 41 + }); 42 + 43 + JButton cancelButton = new JButton("Cancel"); 44 + SwingUtils.addBorderPadding(cancelButton); 45 + cancelButton.addActionListener((e) -> { 46 + setVisible(false); 47 + }); 48 + 49 + setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); 50 + addWindowListener(new java.awt.event.WindowAdapter() { 51 + @Override 52 + public void windowClosing(WindowEvent e) 53 + { 54 + setVisible(false); 55 + } 56 + }); 57 + 58 + fileTypeComboBox = new JComboBox<>(ImpexFormat.values()); 59 + SwingUtils.addBorderPadding(fileTypeComboBox); 60 + 61 + cbSelectedOnly = new JCheckBox(" Selected object only"); 62 + cbSelectedOnly.setSelected(true); 63 + 64 + setLayout(new MigLayout("ins 16, fill, hidemode 3, wrap 2")); 65 + 66 + add(new JLabel("File Format")); 67 + add(fileTypeComboBox, "growx"); 68 + add(cbSelectedOnly, "span, growx, gapbottom 8"); 69 + 70 + add(new JPanel(), "span, split 3, growx, sg but"); 71 + add(cancelButton, "growx, sg but"); 72 + add(selectButton, "growx, sg but"); 73 + 74 + pack(); 75 + setResizable(false); 76 + 77 + setTitle(FRAME_TITLE); 78 + setIconImage(Environment.getDefaultIconImage()); 79 + setLocationRelativeTo(parent); 80 + setModal(false); 81 + } 82 + }
+21
src/main/java/game/map/impex/ImpexFormat.java
··· 1 + package game.map.impex; 2 + 3 + public enum ImpexFormat 4 + { 5 + PREFAB("prefab"), 6 + OBJ("obj"), 7 + FBX("fbx"); 8 + 9 + private final String name; 10 + 11 + private ImpexFormat(String name) 12 + { 13 + this.name = name; 14 + } 15 + 16 + @Override 17 + public String toString() 18 + { 19 + return name; 20 + } 21 + }
+75
src/main/java/game/map/impex/ImportDialog.java
··· 1 + package game.map.impex; 2 + 3 + import java.awt.event.WindowEvent; 4 + 5 + import javax.swing.JButton; 6 + import javax.swing.JCheckBox; 7 + import javax.swing.JComboBox; 8 + import javax.swing.JDialog; 9 + import javax.swing.JFrame; 10 + import javax.swing.JLabel; 11 + import javax.swing.JPanel; 12 + import javax.swing.WindowConstants; 13 + 14 + import app.Environment; 15 + import app.SwingUtils; 16 + import net.miginfocom.swing.MigLayout; 17 + 18 + public class ImportDialog extends JDialog 19 + { 20 + public static final String FRAME_TITLE = "Import"; 21 + 22 + private JComboBox<ImpexFormat> fileTypeComboBox; 23 + private JCheckBox cbSelectedOnly; 24 + 25 + public ImportDialog(JFrame parent) 26 + { 27 + super(parent); 28 + 29 + JButton selectButton = new JButton("Import"); 30 + SwingUtils.addBorderPadding(selectButton); 31 + selectButton.addActionListener((e) -> { 32 + //TODO select file 33 + setVisible(false); 34 + }); 35 + 36 + JButton cancelButton = new JButton("Cancel"); 37 + SwingUtils.addBorderPadding(cancelButton); 38 + cancelButton.addActionListener((e) -> { 39 + setVisible(false); 40 + }); 41 + 42 + setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); 43 + addWindowListener(new java.awt.event.WindowAdapter() { 44 + @Override 45 + public void windowClosing(WindowEvent e) 46 + { 47 + setVisible(false); 48 + } 49 + }); 50 + 51 + fileTypeComboBox = new JComboBox<>(ImpexFormat.values()); 52 + SwingUtils.addBorderPadding(fileTypeComboBox); 53 + 54 + cbSelectedOnly = new JCheckBox(" Selected object only"); 55 + cbSelectedOnly.setSelected(true); 56 + 57 + setLayout(new MigLayout("ins 16, fill, hidemode 3, wrap 2")); 58 + 59 + add(new JLabel("File Format")); 60 + add(fileTypeComboBox, "growx"); 61 + add(cbSelectedOnly, "span, growx, gapbottom 8"); 62 + 63 + add(new JPanel(), "span, split 3, growx, sg but"); 64 + add(cancelButton, "growx, sg but"); 65 + add(selectButton, "growx, sg but"); 66 + 67 + pack(); 68 + setResizable(false); 69 + 70 + setTitle(FRAME_TITLE); 71 + setIconImage(Environment.getDefaultIconImage()); 72 + setLocationRelativeTo(parent); 73 + setModal(false); 74 + } 75 + }