Skip to content

Commit

Permalink
MacOS compatibility fixes.
Browse files Browse the repository at this point in the history
Macs can't handle GL on anything but one thread, so I moved the NFD code out of its new Thread block. I hope that works OK, it seems to run without issues on Windows 11. Vis-UI was also using two conflicting versions, one more Mac-compatible than the other. Now only the newer, better one is used.
  • Loading branch information
tommyettinger committed Aug 16, 2024
1 parent aa6644e commit 849f78a
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 58 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ dependencies {
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
implementation "com.crashinvaders.lml:gdx-kiwi:$lmlVersion"
implementation "com.crashinvaders.lml:gdx-lml:$lmlVersion"
implementation "com.crashinvaders.lml:gdx-lml-vis:$lmlVersion"
implementation("com.crashinvaders.lml:gdx-lml-vis:$lmlVersion"){ exclude group: "com.kotcrab.vis", module: "vis-ui" }
implementation "com.crashinvaders.lml:gdx-autumn:$lmlVersion"
implementation "com.crashinvaders.lml:gdx-autumn-mvc:$lmlVersion"
implementation "com.crashinvaders.lml:gdx-autumn-desktop-fcs:$lmlVersion"
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
org.gradle.jvmargs=-Xms512M -Xmx1G -Dfile.encoding=UTF-8 -Dconsole.encoding=UTF-8
liftoffVersion=1.12.1.13
liftoffVersion=1.12.1.14-SNAPSHOT
kotlinVersion=1.9.24
gdxVersion=1.12.1
lmlVersion=1.10.1.12.1
Expand Down
102 changes: 48 additions & 54 deletions src/main/java/gdx/liftoff/ui/panels/PathsPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,37 +43,34 @@ public void populate(boolean fullscreen) {
Gdx.input.setInputProcessor(null);
Gdx.graphics.setSystemCursor(SystemCursor.Arrow);

Thread filePickerThread = new Thread(() -> {
FileHandle initialFolder = Gdx.files.absolute(Gdx.files.getExternalStoragePath());
if (UserData.projectPath != null && !UserData.projectPath.isEmpty())
initialFolder = Gdx.files.absolute(UserData.projectPath);

Main.pickDirectory(initialFolder, new FileChooserAdapter() {
@Override
public void canceled() {
Gdx.app.postRunnable(() -> Gdx.input.setInputProcessor(stage));
}

@Override
public void selected(Array<FileHandle> files) {
if (files.size > 0) {
String path = files.first().path();
projectFieldButton.setText(path);
UserData.projectPath = path;
pref.putString("projectPath", path);
pref.flush();
updateError();
if (FullscreenDialog.fullscreenDialog != null)
FullscreenDialog.fullscreenDialog.updateGenerateButtons();
if (root.settingsTable != null) root.settingsTable.updateGenerateButton();
root.quickSettingsTable.populate();
updateDeleteProjectPathButton();
}
Gdx.app.postRunnable(() -> Gdx.input.setInputProcessor(stage));
FileHandle initialFolder = Gdx.files.absolute(Gdx.files.getExternalStoragePath());
if (UserData.projectPath != null && !UserData.projectPath.isEmpty())
initialFolder = Gdx.files.absolute(UserData.projectPath);

Main.pickDirectory(initialFolder, new FileChooserAdapter() {
@Override
public void canceled() {
Gdx.app.postRunnable(() -> Gdx.input.setInputProcessor(stage));
}

@Override
public void selected(Array<FileHandle> files) {
if (files.size > 0) {
String path = files.first().path();
projectFieldButton.setText(path);
UserData.projectPath = path;
pref.putString("projectPath", path);
pref.flush();
updateError();
if (FullscreenDialog.fullscreenDialog != null)
FullscreenDialog.fullscreenDialog.updateGenerateButtons();
if (root.settingsTable != null) root.settingsTable.updateGenerateButton();
root.quickSettingsTable.populate();
updateDeleteProjectPathButton();
}
});
Gdx.app.postRunnable(() -> Gdx.input.setInputProcessor(stage));
}
});
filePickerThread.start();
});

//select folder button
Expand Down Expand Up @@ -106,35 +103,32 @@ public void selected(Array<FileHandle> files) {
Gdx.input.setInputProcessor(null);
Gdx.graphics.setSystemCursor(SystemCursor.Arrow);

Thread filePickerThread = new Thread(() -> {
FileHandle initialFolder = Gdx.files.absolute(Gdx.files.getExternalStoragePath());
if (UserData.androidPath != null && !UserData.androidPath.isEmpty())
initialFolder = Gdx.files.absolute(UserData.androidPath);
FileHandle initialFolder = Gdx.files.absolute(Gdx.files.getExternalStoragePath());
if (UserData.androidPath != null && !UserData.androidPath.isEmpty())
initialFolder = Gdx.files.absolute(UserData.androidPath);

Main.pickDirectory(initialFolder, new FileChooserAdapter() {
@Override
public void canceled() {
Gdx.app.postRunnable(() -> Gdx.input.setInputProcessor(stage));
}
Main.pickDirectory(initialFolder, new FileChooserAdapter() {
@Override
public void canceled() {
Gdx.app.postRunnable(() -> Gdx.input.setInputProcessor(stage));
}

@Override
public void selected(Array<FileHandle> files) {
if (files.size > 0) {
String path = files.first().path();
androidFieldButton.setText(path);
UserData.androidPath = path;
pref.putString("AndroidSdk", path);
pref.flush();
updateError();
if (FullscreenDialog.fullscreenDialog != null)
FullscreenDialog.fullscreenDialog.updateGenerateButtons();
if (root.settingsTable != null) root.settingsTable.updateGenerateButton();
}
Gdx.app.postRunnable(() -> Gdx.input.setInputProcessor(stage));
@Override
public void selected(Array<FileHandle> files) {
if (files.size > 0) {
String path = files.first().path();
androidFieldButton.setText(path);
UserData.androidPath = path;
pref.putString("AndroidSdk", path);
pref.flush();
updateError();
if (FullscreenDialog.fullscreenDialog != null)
FullscreenDialog.fullscreenDialog.updateGenerateButtons();
if (root.settingsTable != null) root.settingsTable.updateGenerateButton();
}
});
Gdx.app.postRunnable(() -> Gdx.input.setInputProcessor(stage));
}
});
filePickerThread.start();
});

button = new Button(skin, "folder");
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/gdx/liftoff/config/Configuration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import gdx.liftoff.views.widgets.ScrollableTextArea
@Suppress("unused") // Fields accessed via reflection.
class Configuration {
companion object {
const val VERSION = "1.12.1.13"
const val VERSION = "1.12.1.14-SNAPSHOT"
const val WIDTH = 600
const val HEIGHT = 700
const val PREFERENCES_PATH = "gdx-liftoff-prefs"
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/ui-data/defaults.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
liftoffVersion=1.12.1.13
liftoffVersion=1.12.1.14-SNAPSHOT
projectNameDefault=YourProjectName
packageNameDefault=io.github.some_example_name
mainClassNameDefault=Main
Expand Down

0 comments on commit 849f78a

Please sign in to comment.