diff --git a/_logo files/LOD.svg b/_logo files/LOD.svg
new file mode 100644
index 000000000..6715d231b
--- /dev/null
+++ b/_logo files/LOD.svg
@@ -0,0 +1,64 @@
+
+
+
diff --git a/src/main/java/com/seibel/lod/core/JarMain.java b/src/main/java/com/seibel/lod/core/JarMain.java
index f7ba7c968..0154b0b4c 100644
--- a/src/main/java/com/seibel/lod/core/JarMain.java
+++ b/src/main/java/com/seibel/lod/core/JarMain.java
@@ -2,9 +2,12 @@ package com.seibel.lod.core;
import com.formdev.flatlaf.FlatDarkLaf;
import com.formdev.flatlaf.FlatLightLaf;
+import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler;
import com.seibel.lod.core.jar.DarkModeDetector;
+import com.seibel.lod.core.jar.BaseJFrame;
import com.seibel.lod.core.jar.JarDependencySetup;
+import javax.imageio.ImageIO;
import javax.swing.*;
import java.io.*;
import java.nio.charset.StandardCharsets;
@@ -32,12 +35,49 @@ public class JarMain {
JarDependencySetup.createInitialBindings();
+ SingletonHandler.finishBinding();
System.out.println("WARNING: The standalone jar still work in progress");
- JOptionPane.showMessageDialog(null, "The GUI for the standalone jar isn't made yet\nIf you want to use the mod then put it in your mods folder", "Distant Horizons", JOptionPane.WARNING_MESSAGE);
+
+ /*
+ To other devs
+
+ For now im just working on linux stuff (so i can use the linux file system when installing the mod)
+ once i got it working ill fix it for windows/mac
+ */
+ if (!getOperatingSystem().equals(OperatingSystem.LINUX)) {
+ JOptionPane.showMessageDialog(null, "The GUI for the standalone jar isn't made yet\nIf you want to use the mod then put it in your mods folder", "Distant Horizons", JOptionPane.WARNING_MESSAGE);
+ System.out.println("If you want the gui then please use linux for the time being.\nWindows and MacOS support will come later on");
+ return;
+ }
+
+ BaseJFrame frame = new BaseJFrame(false, false);
+ String[] optionsToChoose = {"Apple", "Orange", "Banana", "Pineapple", "None of the listed"};
+ JComboBox jTest = new JComboBox<>(optionsToChoose);
+ jTest.setBounds(80, 50, 140, 20);
+ frame.add(jTest);
+
+
+ frame.setLayout(null); // Remove the default layout
+
+ frame.validate(); // Update to add the widgets
+ frame.setVisible(true); // Start the ui
}
+ public enum OperatingSystem {WINDOWS, MACOS, LINUX, NONE}
+ public static OperatingSystem getOperatingSystem() {
+ String os = System.getProperty("os.name").toLowerCase();
+ if (os.contains("win")) {
+ return OperatingSystem.WINDOWS;
+ } else if (os.contains("mac")) {
+ return OperatingSystem.MACOS;
+ } else if (os.contains("nix") || os.contains("nux")) {
+ return OperatingSystem.LINUX;
+ } else {
+ return OperatingSystem.NONE;
+ }
+ }
/** Get a file within the mods resources */
public static InputStream accessFile(String resource) {
diff --git a/src/main/java/com/seibel/lod/core/jar/BaseJFrame.java b/src/main/java/com/seibel/lod/core/jar/BaseJFrame.java
new file mode 100644
index 000000000..0d652656c
--- /dev/null
+++ b/src/main/java/com/seibel/lod/core/jar/BaseJFrame.java
@@ -0,0 +1,29 @@
+package com.seibel.lod.core.jar;
+
+import com.seibel.lod.core.JarMain;
+import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler;
+import com.seibel.lod.core.wrapperInterfaces.config.IConfigWrapper;
+
+import javax.imageio.ImageIO;
+import javax.swing.*;
+
+public class BaseJFrame extends JFrame {
+ public BaseJFrame() {
+ init();
+ }
+ public BaseJFrame(boolean show, boolean resizable) {
+ init();
+ setVisible(show);
+ setResizable(resizable);
+ }
+
+ public void init() {
+ setTitle(SingletonHandler.get(IConfigWrapper.class).getLang("lod.title"));
+ try {
+ setIconImage(ImageIO.read(JarMain.accessFile("icon.png")));
+ } catch (Exception e) {e.printStackTrace();}
+ setSize(1280,720);
+ setLocationRelativeTo(null); // Puts the window at the middle of the screen
+ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ }
+}
diff --git a/src/main/java/com/seibel/lod/core/jar/DarkModeDetector.java b/src/main/java/com/seibel/lod/core/jar/DarkModeDetector.java
index 7682ff196..0adbb085b 100644
--- a/src/main/java/com/seibel/lod/core/jar/DarkModeDetector.java
+++ b/src/main/java/com/seibel/lod/core/jar/DarkModeDetector.java
@@ -3,6 +3,8 @@ package com.seibel.lod.core.jar;
import java.io.*;
import java.util.regex.Pattern;
+import static com.seibel.lod.core.JarMain.getOperatingSystem;
+
/**
* A fork of iris'is dark mode detector (https://github.com/IrisShaders/Iris-Installer/blob/master/src/main/java/net/hypercubemc/iris_installer/DarkModeDetector.java)
* Which is a fork of HanSolo's dark mode detector (https://gist.github.com/HanSolo/7cf10b86efff8ca2845bf5ec2dd0fe1d)
@@ -14,8 +16,6 @@ import java.util.regex.Pattern;
* @author coolGi2007
*/
public class DarkModeDetector {
- public enum OperatingSystem {WINDOWS, MACOS, LINUX, SOLARIS, NONE}
-
private static final String REGQUERY_UTIL = "reg query ";
private static final String REGDWORD_TOKEN = "REG_DWORD";
private static final String DARK_THEME_CMD = REGQUERY_UTIL + "\"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize\"" + " /v AppsUseLightTheme";
@@ -28,7 +28,6 @@ public class DarkModeDetector {
return isMacOsDarkMode();
case LINUX:
return checkLinuxDark();
- case SOLARIS: // Idk anyone who uses solaris so we skip them
default:
return false;
}
@@ -63,7 +62,7 @@ public class DarkModeDetector {
}
- // On linux there are 2 popilar formats for theming
+ // On Linux there are 2 popular formats for theming
// They are qt and gtk. We check the desktop environment and use that to pick which one to use (if none work then use GTK)
public static boolean checkLinuxDark() {
// Checks "/usr/bin" as "echo $XDG_CURRENT_DESKTOP" dosnt work in java and dosnt detect window managers
@@ -80,7 +79,7 @@ public class DarkModeDetector {
}
public static boolean GTKChecker() {
- // Checks if the return to "gsettings get org.gnome.desktop.interface color-scheme" in terminal is 'prefer-dark' or contains thw word dark in it
+ // Checks if the return to "gsettings get org.gnome.desktop.interface color-scheme" in terminal is 'prefer-dark' or contains the word dark in it
final Pattern darkThemeNamePattern = Pattern.compile(".*dark.*", Pattern.CASE_INSENSITIVE);
return darkThemeNamePattern.matcher(query("gsettings get org.gnome.desktop.interface color-scheme")).matches();
}
@@ -90,14 +89,14 @@ public class DarkModeDetector {
// With that you grayscale the rgb and check if it is over/under 128
// If there is a better way of doing this then please let me know
- // This seems like the best way as qt dosnt have a preference and just stores pure color values
+ // This seems like the best way as qt dosnt have a dark/light preference and just stores pure color values
try {
File themeFile = new File(System.getProperty("user.home") + "/.config/Trolltech.conf");
BufferedReader reader = new BufferedReader(new FileReader(themeFile));
String themeLine = reader.readLine();
- while (themeLine != null) { // Go trough each line till you find "KWinPalette\activeBackground"
+ while (themeLine != null) { // Go through each line till you find "KWinPalette\activeBackground"
if (themeLine.contains("KWinPalette\\activeBackground"))
break;
themeLine = reader.readLine();
@@ -118,46 +117,6 @@ public class DarkModeDetector {
-
- @Deprecated // I was going to do a check for each desktop before but decided to check the gtk and qt values instead
- public static boolean XfceChecker() {
- // Bit of a bad way of doing this but it checks "~/.config/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml"
- // Then it checks for line and checks if that line includes the word dark
-
-
- try { // Just wrap entire code in try/catch, fixes everything (TODO dont put everything in try/catch)
- File themeFile = new File(System.getProperty("user.home") + "/.config/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml");
-
- BufferedReader reader = new BufferedReader(new FileReader(themeFile));
- String themeLine = reader.readLine();
- while (themeLine != null) { // Go trough each line till you find "KWinPalette\activeBackground"
- if (themeLine.contains("name=\"ThemeName\""))
- break;
- themeLine = reader.readLine();
- }
- reader.close();
-
- return themeLine.toLowerCase().contains("dark");
- } catch (Exception e) { e.printStackTrace(); return false;}
- }
-
-
-
- public static OperatingSystem getOperatingSystem() {
- String os = System.getProperty("os.name").toLowerCase();
- if (os.contains("win")) {
- return OperatingSystem.WINDOWS;
- } else if (os.contains("mac")) {
- return OperatingSystem.MACOS;
- } else if (os.contains("nix") || os.contains("nux")) {
- return OperatingSystem.LINUX;
- } else if (os.contains("sunos")) {
- return OperatingSystem.SOLARIS;
- } else {
- return OperatingSystem.NONE;
- }
- }
-
/** Runs a command trough command line */
private static String query(String cmd) {
try {
diff --git a/src/main/resources/icon.svg b/src/main/resources/icon.svg
new file mode 100644
index 000000000..6715d231b
--- /dev/null
+++ b/src/main/resources/icon.svg
@@ -0,0 +1,64 @@
+
+
+