Skip to content

Commit

Permalink
Merge pull request #689 from BenjaminAmos/macos-aarch64-support
Browse files Browse the repository at this point in the history
Attempted macOS AArch64 support
  • Loading branch information
BenjaminAmos authored Dec 3, 2023
2 parents 0263edf + 397ec4b commit b7953a1
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 10 deletions.
4 changes: 2 additions & 2 deletions build-logic/src/main/groovy/destination-sol-constants.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ ext {

engineVersion = '2.1.0'
gestaltVersion = '8.0.0-SNAPSHOT'
gdxVersion = '1.9.14'
gdxVersion = '1.12.1'
// The LibGDX controllers library is versioned differently to the main LibGDX versions.
// See https://github.com/libgdx/gdx-controllers/wiki/Compatibility for compatible versions.
gdxControllersVersion = '2.1.0'
gdxControllersVersion = '2.2.3'
nuiVersion = '4.0.0-SNAPSHOT'
}
3 changes: 2 additions & 1 deletion build-logic/src/main/groovy/destination-sol-jre.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def jreUrlBase = "https://download.bell-sw.com/java/$jreVersion/bellsoft-jre$jre
def jreUrlFilenames = [
lwjreLinux64 : 'linux-amd64.tar.gz',
lwjre : 'windows-i586.zip',
lwjreOSX : 'macos-amd64.zip'
lwjreOSX : 'macos-amd64.zip',
lwjreOSXArm : 'macos-aarch64.zip'
]

tasks.register('downloadJreAll') {
Expand Down
12 changes: 7 additions & 5 deletions engine/src/main/java/org/destinationsol/ui/SolInputManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,13 @@ private void maybeFixMousePos() {
int mouseX = Gdx.input.getX();
int mouseY = Gdx.input.getY();
// TODO: look into the usefulness of this, and replace with Gdx.graphics.* with displayDimensions if nothing else
int w = Gdx.graphics.getWidth();
int h = Gdx.graphics.getHeight();
mouseX = (int) MathUtils.clamp((float) mouseX, (float) 0, (float) w);
mouseY = (int) MathUtils.clamp((float) mouseY, (float) 0, (float) h);
Gdx.input.setCursorPosition(mouseX, mouseY);
int screenWidth = Gdx.graphics.getWidth();
int screenHeight = Gdx.graphics.getHeight();
if (mouseX < 0 || mouseX >= screenWidth || mouseY < 0 || mouseY >= screenHeight) {
mouseX = (int) MathUtils.clamp((float) mouseX, (float) 0, (float) screenWidth - 1);
mouseY = (int) MathUtils.clamp((float) mouseY, (float) 0, (float) screenHeight - 1);
Gdx.input.setCursorPosition(mouseX, mouseY);
}
}

private void updatePointers() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ public boolean touchUp(int screenX, int screenY, int pointer, int button) {
return false;
}

@Override
public boolean touchCancelled(int screenX, int screenY, int pointer, int button) {
return false;
}

@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
inputManager.maybeTouchDragged(screenX, screenY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public NUIManager(SolApplication solApplication,
UIText.DEFAULT_CURSOR_TEXTURE = whiteTexture;

// NOTE: SolApplication::addResizeSubscriber is not intended to be static, so use the instance form for compatibility
solApplication.addResizeSubscriber(() -> resize(Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight()));
solApplication.addResizeSubscriber(() -> resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()));

// Mobile screen densities can vary considerably, so a large digital resolution can be displayed
// on a very small screen. Due to this, it makes sense to scale the UI roughly proportionally
Expand Down
14 changes: 13 additions & 1 deletion launcher/solOSX.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
#!/usr/bin/env bash
lwjreOSX/bin/java -XstartOnFirstThread -jar libs/solDesktop.jar -noSplash

JRE=lwjreOSX/bin/java
ARCH=$(uname -m)
if [[ "$ARCH" == "x86_64" ]]; then
JRE=lwjreOSX/bin/java
elif [[ "$ARCH" == "arm64" ]]; then
JRE=lwjreOSXArm/bin/java
else
echo "Unsupported architecture $ARCH"
exit 1
fi

$JRE -XstartOnFirstThread -jar libs/solDesktop.jar -noSplash

0 comments on commit b7953a1

Please sign in to comment.