Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3a48735e3 | ||
|
|
893c8d2304 | ||
|
|
2abf7d75e0 | ||
|
|
03a60da816 |
No files matched your search
@@ -152,13 +152,3 @@ Thumbs.db
|
||||
*~
|
||||
*.*#
|
||||
*#*#
|
||||
/.kotlin/
|
||||
/assets/assets.txt
|
||||
|
||||
## Special cases:
|
||||
|
||||
## There is a resource-config.json file generated by nativeimage.gradle if you use Graal Native Image.
|
||||
## Some usage may need extra resource configuration in a different file with the same name.
|
||||
## You could also add that configuration to the text in nativeimage.gradle .
|
||||
## You should delete or comment out the next line if you have configuration in a different resource-config.json .
|
||||
**/resource-config.json
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
|
||||
main:
|
||||
clear
|
||||
gradle lwjgl3:run
|
||||
|
||||
|
||||
@@ -8,12 +9,4 @@ build:
|
||||
gradle lwjgl3:dist
|
||||
|
||||
|
||||
html:
|
||||
gradlew.bat teavm:build
|
||||
|
||||
help:
|
||||
.\gradlew.bat projects
|
||||
.\gradlew.bat projects
|
||||
|
||||
|
||||
|
||||
@@ -21,4 +21,3 @@ A [libGDX](https://libgdx.com/) project generated with [gdx-liftoff](https://git
|
||||
|
||||
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 2.4 KiB |
@@ -1,13 +1,15 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven { url 'https://s01.oss.sonatype.org' }
|
||||
mavenLocal()
|
||||
google()
|
||||
maven { url = 'https://central.sonatype.com/repository/maven-snapshots/' }
|
||||
gradlePluginPortal()
|
||||
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
|
||||
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
|
||||
}
|
||||
dependencies {
|
||||
|
||||
classpath "org.docstr:gwt-gradle-plugin:$gwtPluginVersion"
|
||||
|
||||
}
|
||||
}
|
||||
@@ -15,56 +17,27 @@ buildscript {
|
||||
allprojects {
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'idea'
|
||||
|
||||
// This allows you to "Build and run using IntelliJ IDEA", an option in IDEA's Settings.
|
||||
idea {
|
||||
module {
|
||||
outputDir = file('build/classes/java/main')
|
||||
testOutputDir = file('build/classes/java/test')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
configure(subprojects) {
|
||||
apply plugin: 'java-library'
|
||||
java.sourceCompatibility = 11
|
||||
java.targetCompatibility = 11
|
||||
|
||||
// From https://lyze.dev/2021/04/29/libGDX-Internal-Assets-List/
|
||||
// The article can be helpful when using assets.txt in your project.
|
||||
tasks.register('generateAssetList') {
|
||||
inputs.dir("${project.rootDir}/assets/")
|
||||
// projectFolder/assets
|
||||
File assetsFolder = new File("${project.rootDir}/assets/")
|
||||
// projectFolder/assets/assets.txt
|
||||
File assetsFile = new File(assetsFolder, "assets.txt")
|
||||
// delete that file in case we've already created it
|
||||
assetsFile.delete()
|
||||
|
||||
// iterate through all files inside that folder
|
||||
// convert it to a relative path
|
||||
// and append it to the file assets.txt
|
||||
fileTree(assetsFolder).collect { assetsFolder.relativePath(it) }.sort().each {
|
||||
assetsFile.append(it + "\n")
|
||||
}
|
||||
}
|
||||
processResources.dependsOn 'generateAssetList'
|
||||
|
||||
sourceCompatibility = 11
|
||||
compileJava {
|
||||
options.incremental = true
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
version = "$projectVersion"
|
||||
version = '1.0.0'
|
||||
ext.appName = 'Doppelspalt'
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url 'https://s01.oss.sonatype.org' }
|
||||
// You may want to remove the following line if you have errors downloading dependencies.
|
||||
mavenLocal()
|
||||
maven { url = 'https://central.sonatype.com/repository/maven-snapshots/' }
|
||||
maven { url = 'https://jitpack.io' }
|
||||
maven { url = 'https://teavm.org/maven/repository/' }
|
||||
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
|
||||
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,7 @@
|
||||
eclipse.project.name = appName + '-core'
|
||||
|
||||
dependencies {
|
||||
api "com.badlogicgames.gdx:gdx:$gdxVersion"
|
||||
api "com.badlogicgames.gdx:gdx:$gdxVersion"
|
||||
api "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
|
||||
|
||||
if(enableGraalNative == 'true') {
|
||||
implementation "io.github.berstanio:gdx-svmhelper-annotations:$graalHelperVersion"
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
}
|
||||
@@ -208,4 +208,3 @@ public class FullscreenButton extends ImageButton {
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.10.0//EN" "https://www.gwtproject.org/doctype/2.10.0/gwt-module.dtd">
|
||||
<module>
|
||||
<source path="" />
|
||||
|
||||
</module>
|
||||
@@ -443,4 +443,3 @@ public class Main implements ApplicationListener {
|
||||
@Override public void resume() {}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +1,6 @@
|
||||
# This doesn't need to be false, and some projects may be able to take advantage of setting daemon to true.
|
||||
# We set it to false by default in order to avoid too many daemons from being created and persisting; each needs RAM.
|
||||
org.gradle.daemon=false
|
||||
# Sets starting memory usage to 512MB, maximum memory usage to 1GB, and tries to set as much to use Unicode as we can.
|
||||
org.gradle.jvmargs=-Xms512M -Xmx1G -Dfile.encoding=UTF-8 -Dconsole.encoding=UTF-8
|
||||
# "Configure on-demand" must be false because it breaks projects that have Android modules. The default is also false.
|
||||
org.gradle.daemon=true
|
||||
org.gradle.jvmargs=-Xms512M -Xmx1G
|
||||
org.gradle.configureondemand=false
|
||||
# The logging level determines which messages get shown about how Gradle itself is working, such as if build.gradle
|
||||
# files are fully future-proof (which they never are, because Gradle constantly deprecates working APIs).
|
||||
# You can change 'quiet' below to 'lifecycle' to use Gradle's default behavior, which shows some confusing messages.
|
||||
# You could instead change 'quiet' below to 'info' to see info that's important mainly while debugging build files.
|
||||
# Note that if you want to use Gradle Build Scans, you should set the below logging level to 'lifecycle', otherwise
|
||||
# the link to the scan won't get shown at all.
|
||||
# Documented at: https://docs.gradle.org/current/userguide/command_line_interface.html#sec:command_line_logging
|
||||
org.gradle.logging.level=quiet
|
||||
lwjgl3Version=3.4.3
|
||||
graalHelperVersion=2.0.1
|
||||
robovmVersion=2.3.23
|
||||
gdxTeaVMVersion=1.6.2
|
||||
enableGraalNative=false
|
||||
gdxVersion=1.14.2
|
||||
projectVersion=1.0.0
|
||||
gwtFrameworkVersion=2.10.0
|
||||
gwtPluginVersion=1.1.29
|
||||
gdxVersion=1.12.1
|
||||
@@ -1,12 +0,0 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/402983f310a88ac68b3e883c7c91c760/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/e50b80b5a11d194a898bc3e6211b7c4b/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/402983f310a88ac68b3e883c7c91c760/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/e50b80b5a11d194a898bc3e6211b7c4b/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/f257be9f04bfdf169051808541767806/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/1dcbacacca32618bd21ec5465779ade1/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/402983f310a88ac68b3e883c7c91c760/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/e50b80b5a11d194a898bc3e6211b7c4b/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1e91f45234d88a64dafb961c93ddc75a/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/5a88b04b5e582b332d2e6bc12b45f1b9/redirect
|
||||
toolchainVersion=21
|
||||
@@ -1,9 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
||||
networkTimeout=10000
|
||||
retries=0
|
||||
retryBackOffMs=500
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015 the original authors.
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -15,12 +15,10 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# gradlew start up script for POSIX generated by Gradle.
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
@@ -29,7 +27,7 @@
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh gradlew
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
@@ -57,7 +55,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -86,7 +84,7 @@ done
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -114,6 +112,7 @@ case "$( uname )" in #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@@ -171,6 +170,7 @@ fi
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
@@ -203,14 +203,15 @@ fi
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
|
||||
@@ -13,18 +13,16 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem gradlew startup script for Windows
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables, and ensure extensions are enabled
|
||||
setlocal EnableExtensions
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@@ -45,13 +43,13 @@ set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
"%COMSPEC%" /c exit 1
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
@@ -59,24 +57,36 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
"%COMSPEC%" /c exit 1
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute gradlew
|
||||
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
|
||||
@rem which allows us to clear the local environment before executing the java command
|
||||
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:exitWithErrorLevel
|
||||
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
|
||||
"%COMSPEC%" /c exit %ERRORLEVEL%
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -0,0 +1,153 @@
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'org.gretty:gretty:3.1.0'
|
||||
}
|
||||
}
|
||||
apply plugin: "gwt"
|
||||
apply plugin: "war"
|
||||
apply plugin: "org.gretty"
|
||||
|
||||
gwt {
|
||||
gwtVersion = "$gwtFrameworkVersion" // Should match the version used for building the GWT backend. See gradle.properties.
|
||||
maxHeapSize = '1G' // Default 256m is not enough for the GWT compiler. GWT is HUNGRY.
|
||||
minHeapSize = '1G'
|
||||
|
||||
src = files(file('src/main/java')) // Needs to be in front of "modules" below.
|
||||
modules 'io.doppelspalt.GdxDefinition'
|
||||
devModules 'io.doppelspalt.GdxDefinitionSuperdev'
|
||||
project.webAppDirName = 'webapp'
|
||||
|
||||
compiler.strict = true
|
||||
compiler.disableCastChecking = true
|
||||
//// The next line can be useful to uncomment if you want output that hasn't been obfuscated.
|
||||
// compiler.style = org.docstr.gradle.plugins.gwt.Style.DETAILED
|
||||
|
||||
sourceLevel = 1.11
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
|
||||
implementation "com.github.tommyettinger:gdx-backend-gwt:1.1210.0"
|
||||
implementation "com.github.tommyettinger:gdx-backend-gwt:1.1210.0:sources"
|
||||
implementation "com.google.jsinterop:jsinterop-annotations:2.0.0:sources"
|
||||
implementation project(':core')
|
||||
|
||||
}
|
||||
|
||||
import org.akhikhl.gretty.AppBeforeIntegrationTestTask
|
||||
import org.docstr.gradle.plugins.gwt.GwtSuperDev
|
||||
|
||||
gretty.httpPort = 8080
|
||||
// The line below will need to be changed only if you change the build directory to something other than "build".
|
||||
gretty.resourceBase = "${project.layout.buildDirectory.asFile.get().absolutePath}/gwt/draftOut"
|
||||
gretty.contextPath = "/"
|
||||
gretty.portPropertiesFileName = "TEMP_PORTS.properties"
|
||||
|
||||
task startHttpServer (dependsOn: [draftCompileGwt]) {
|
||||
doFirst {
|
||||
copy {
|
||||
from "webapp"
|
||||
into gretty.resourceBase
|
||||
}
|
||||
copy {
|
||||
from "war"
|
||||
into gretty.resourceBase
|
||||
}
|
||||
}
|
||||
}
|
||||
task beforeRun(type: AppBeforeIntegrationTestTask, dependsOn: startHttpServer) {
|
||||
// The next line allows ports to be reused instead of
|
||||
// needing a process to be manually terminated.
|
||||
file("build/TEMP_PORTS.properties").delete()
|
||||
// Somewhat of a hack; uses Gretty's support for wrapping a task in
|
||||
// a start and then stop of a Jetty server that serves files while
|
||||
// also running the SuperDev code server.
|
||||
integrationTestTask 'superDev'
|
||||
|
||||
interactive false
|
||||
}
|
||||
|
||||
task superDev(type: GwtSuperDev) {
|
||||
doFirst {
|
||||
gwt.modules = gwt.devModules
|
||||
}
|
||||
}
|
||||
|
||||
//// We delete the (temporary) war/ folder because if any extra files get into it, problems occur.
|
||||
//// The war/ folder shouldn't be committed to version control.
|
||||
clean.delete += [file("war")]
|
||||
|
||||
// This next line can be changed if you want to, for instance, always build into the
|
||||
// docs/ folder of a Git repo, which can be set to automatically publish on GitHub Pages.
|
||||
// This is relative to the html/ folder.
|
||||
var outputPath = "build/dist/"
|
||||
|
||||
task dist(dependsOn: [clean, compileGwt]) {
|
||||
doLast {
|
||||
// Uncomment the next line if you have changed outputPath and know that its contents
|
||||
// should be replaced by a new dist build. Some large JS files are not cleaned up by
|
||||
// default unless the outputPath is inside build/ (then the clean task removes them).
|
||||
// Do not uncomment the next line if you changed outputPath to a folder that has
|
||||
// non-generated files that you want to keep!
|
||||
//delete(file(outputPath))
|
||||
|
||||
file(outputPath).mkdirs()
|
||||
copy {
|
||||
from("build/gwt/out"){
|
||||
exclude '**/*.symbolMap' // Not used by a dist, and these can be large.
|
||||
}
|
||||
into outputPath
|
||||
}
|
||||
copy {
|
||||
from("webapp") {
|
||||
exclude 'index.html' // We edit this HTML file later.
|
||||
exclude 'refresh.png' // We don't need this button; this saves some bytes.
|
||||
}
|
||||
into outputPath
|
||||
}
|
||||
copy {
|
||||
from("webapp") {
|
||||
// These next two lines take the index.html page and remove the superdev refresh button.
|
||||
include 'index.html'
|
||||
filter { String line -> line.replaceAll('<a class="superdev" .+', '') }
|
||||
// This does not modify the original index.html, only the copy in the dist.
|
||||
// If you decide to manually remove or comment out the superdev button from index.html, you should also
|
||||
// either remove or comment out only the "filter" line above this.
|
||||
}
|
||||
into outputPath
|
||||
}
|
||||
copy {
|
||||
from "war"
|
||||
into outputPath
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task addSource {
|
||||
doLast {
|
||||
sourceSets.main.compileClasspath += files(project(':core').sourceSets.main.allJava.srcDirs)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
task distZip(type: Zip, dependsOn: dist){
|
||||
//// This uses the output of the dist task, which removes the superdev button from index.html .
|
||||
from(outputPath)
|
||||
archiveBaseName.set("${appName}-dist")
|
||||
//// The result will be in html/build/ with a name containing "-dist".
|
||||
destinationDirectory.set(file("build"))
|
||||
}
|
||||
|
||||
tasks.compileGwt.dependsOn(addSource)
|
||||
tasks.draftCompileGwt.dependsOn(addSource)
|
||||
tasks.checkGwt.dependsOn(addSource)
|
||||
|
||||
java.sourceCompatibility = JavaVersion.VERSION_11
|
||||
java.targetCompatibility = JavaVersion.VERSION_11
|
||||
sourceSets.main.java.srcDirs = [ "src/main/java/" ]
|
||||
|
||||
eclipse.project.name = appName + "-html"
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.10.0//EN" "https://www.gwtproject.org/doctype/2.10.0/gwt-module.dtd">
|
||||
<module rename-to="html">
|
||||
<source path="" />
|
||||
<inherits name="com.badlogic.gdx.backends.gdx_backends_gwt" />
|
||||
<inherits name="io.doppelspalt.Main" />
|
||||
<entry-point class="io.doppelspalt.gwt.GwtLauncher" />
|
||||
<set-configuration-property name="gdx.assetpath" value="../assets" />
|
||||
<set-configuration-property name="xsiframe.failIfScriptTag" value="FALSE"/>
|
||||
<!-- These two lines reduce the work GWT has to do during compilation and also shrink output size. -->
|
||||
<set-property name="user.agent" value="gecko1_8, safari"/>
|
||||
<collapse-property name="user.agent" values="*" />
|
||||
<!-- Remove the "user.agent" lines above if you encounter issues with Safari or other Gecko browsers. -->
|
||||
</module>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.10.0//EN" "https://www.gwtproject.org/doctype/2.10.0/gwt-module.dtd">
|
||||
<module rename-to="html">
|
||||
<inherits name="io.doppelspalt.GdxDefinition" />
|
||||
<collapse-all-properties />
|
||||
<add-linker name="xsiframe"/>
|
||||
<set-configuration-property name="devModeRedirectEnabled" value="true"/>
|
||||
<set-configuration-property name="xsiframe.failIfScriptTag" value="FALSE"/>
|
||||
</module>
|
||||
@@ -0,0 +1,26 @@
|
||||
package io.doppelspalt.gwt;
|
||||
|
||||
import com.badlogic.gdx.ApplicationListener;
|
||||
import com.badlogic.gdx.backends.gwt.GwtApplication;
|
||||
import com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration;
|
||||
import io.doppelspalt.Main;
|
||||
|
||||
/** Launches the GWT application. */
|
||||
public class GwtLauncher extends GwtApplication {
|
||||
@Override
|
||||
public GwtApplicationConfiguration getConfig () {
|
||||
// Resizable application, uses available space in browser with no padding:
|
||||
GwtApplicationConfiguration cfg = new GwtApplicationConfiguration(true);
|
||||
cfg.padVertical = 0;
|
||||
cfg.padHorizontal = 0;
|
||||
return cfg;
|
||||
// If you want a fixed size application, comment out the above resizable section,
|
||||
// and uncomment below:
|
||||
//return new GwtApplicationConfiguration(640, 480);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationListener createApplicationListener () {
|
||||
return new Main();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" ?>
|
||||
<web-app>
|
||||
</web-app>
|
||||
@@ -0,0 +1,31 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>libGDX application</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta id="gameViewport" name="viewport" content="width=device-width initial-scale=1">
|
||||
<link href="styles.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<a class="superdev" href="javascript:%7B%20window.__gwt_bookmarklet_params%20%3D%20%7B'server_url'%3A'http%3A%2F%2Flocalhost%3A9876%2F'%7D%3B%20var%20s%20%3D%20document.createElement('script')%3B%20s.src%20%3D%20'http%3A%2F%2Flocalhost%3A9876%2Fdev_mode_on.js'%3B%20void(document.getElementsByTagName('head')%5B0%5D.appendChild(s))%3B%7D">↻</a>
|
||||
<div align="center" id="embed-html"></div>
|
||||
<script type="text/javascript" src="html/html.nocache.js"></script>
|
||||
</body>
|
||||
|
||||
<script>
|
||||
function handleMouseDown(evt) {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
window.focus();
|
||||
}
|
||||
|
||||
function handleMouseUp(evt) {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
}
|
||||
document.addEventListener('contextmenu', event => event.preventDefault());
|
||||
document.getElementById('embed-html').addEventListener('mousedown', handleMouseDown, false);
|
||||
document.getElementById('embed-html').addEventListener('mouseup', handleMouseUp, false);
|
||||
</script>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 232 B |
@@ -0,0 +1,53 @@
|
||||
canvas {
|
||||
cursor: default;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: #222222;
|
||||
}
|
||||
|
||||
p {
|
||||
text-align: center;
|
||||
color: #eeeeee;
|
||||
}
|
||||
|
||||
a {
|
||||
text-align: center;
|
||||
color: #bbbbff;
|
||||
}
|
||||
|
||||
.superdev {
|
||||
color: rgb(37,37,37);
|
||||
text-shadow: 0px 1px 1px rgba(250,250,250,0.1);
|
||||
font-size: 50pt;
|
||||
display: block;
|
||||
position: relative;
|
||||
text-decoration: none;
|
||||
background-color: rgb(83,87,93);
|
||||
box-shadow: 0px 3px 0px 0px rgb(34,34,34),
|
||||
0px 7px 10px 0px rgb(17,17,17),
|
||||
inset 0px 1px 1px 0px rgba(250, 250, 250, .2),
|
||||
inset 0px -12px 35px 0px rgba(0, 0, 0, .5);
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
border: 0;
|
||||
border-radius: 35px;
|
||||
text-align: center;
|
||||
line-height: 68px;
|
||||
}
|
||||
|
||||
.superdev:active {
|
||||
box-shadow: 0px 0px 0px 0px rgb(34,34,34),
|
||||
0px 3px 7px 0px rgb(17,17,17),
|
||||
inset 0px 1px 1px 0px rgba(250, 250, 250, .2),
|
||||
inset 0px -10px 35px 5px rgba(0, 0, 0, .5);
|
||||
background-color: rgb(83,87,93);
|
||||
top: 3px;
|
||||
color: #fff;
|
||||
text-shadow: 0px 0px 3px rgb(250,250,250);
|
||||
}
|
||||
|
||||
.superdev:hover {
|
||||
background-color: rgb(100,100,100);
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>${app.name}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${app.executable}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${app.id}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${app.name}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>${app.version}</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${app.build}</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
<key>UIStatusBarHidden</key>
|
||||
<true/>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>12.0</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>opengles-2</string>
|
||||
<string>arm64</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>CFBundleIconName</key>
|
||||
<string>AppIcon</string>
|
||||
<key>UIRequiresFullScreen</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,33 +0,0 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.mobidevelop.robovm:robovm-gradle-plugin:$robovmVersion"
|
||||
}
|
||||
}
|
||||
apply plugin: 'robovm'
|
||||
|
||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||
|
||||
ext {
|
||||
mainClassName = "io.doppelspalt.IOSLauncher"
|
||||
}
|
||||
|
||||
launchIPhoneSimulator.dependsOn build
|
||||
launchIPadSimulator.dependsOn build
|
||||
launchIOSDevice.dependsOn build
|
||||
createIPA.dependsOn build
|
||||
|
||||
eclipse.project {
|
||||
name = appName + "-ios"
|
||||
natures 'org.robovm.eclipse.RoboVMNature'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "com.badlogicgames.gdx:gdx-backend-robovm-metalangle:$gdxVersion"
|
||||
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
|
||||
implementation "com.mobidevelop.robovm:robovm-cocoatouch:$robovmVersion"
|
||||
implementation "com.mobidevelop.robovm:robovm-rt:$robovmVersion"
|
||||
implementation project(':core')
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="Logo" translatesAutoresizingMaskIntoConstraints="NO" id="hN2-E0-Tu8">
|
||||
<rect key="frame" x="120" y="402" width="172" height="93"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="52.173913043478265" y="375"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="Logo" width="243" height="41"/>
|
||||
</resources>
|
||||
</document>
|
||||
@@ -1,116 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "iphone-notification-icon-20@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "iphone-notification-icon-20@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "iphone-spotlight-settings-icon-29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "iphone-spotlight-settings-icon-29@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "iphone-spotlight-icon-40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "iphone-spotlight-icon-40@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "iphone-app-icon-60@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "iphone-app-icon-60@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "ipad-notifications-icon-20@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "ipad-notifications-icon-20@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "ipad-settings-icon-29@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "ipad-settings-icon-29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "ipad-spotlight-icon-40@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "ipad-spotlight-icon-40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "ipad-app-icon-76@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "ipad-app-icon-76@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "83.5x83.5",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "ipad-pro-app-icon-83.5@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "1024x1024",
|
||||
"idiom" : "ios-marketing",
|
||||
"filename" : "app-store-icon-1024@1x.png",
|
||||
"scale" : "1x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 736 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 272 B |
|
Before Width: | Height: | Size: 501 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 384 B |
|
Before Width: | Height: | Size: 654 B |
|
Before Width: | Height: | Size: 501 B |
|
Before Width: | Height: | Size: 769 B |
|
Before Width: | Height: | Size: 949 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 501 B |
|
Before Width: | Height: | Size: 627 B |
|
Before Width: | Height: | Size: 769 B |
|
Before Width: | Height: | Size: 949 B |
|
Before Width: | Height: | Size: 654 B |
|
Before Width: | Height: | Size: 791 B |
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "libgdx@1x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "libgdx@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "libgdx@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 5.4 KiB |
@@ -1,33 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrivacyAccessedAPITypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NSPrivacyAccessedAPIType</key>
|
||||
<string>NSPrivacyAccessedAPICategoryDiskSpace</string>
|
||||
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||
<array>
|
||||
<string>E174.1</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyAccessedAPIType</key>
|
||||
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
|
||||
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||
<array>
|
||||
<string>C617.1</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyAccessedAPIType</key>
|
||||
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
|
||||
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||
<array>
|
||||
<string>35F9.1</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,6 +0,0 @@
|
||||
app.version=1.0.0
|
||||
app.id=io.doppelspalt
|
||||
app.mainclass=io.doppelspalt.IOSLauncher
|
||||
app.executable=IOSLauncher
|
||||
app.build=1
|
||||
app.name=Doppelspalt
|
||||
@@ -1,51 +0,0 @@
|
||||
<config>
|
||||
<executableName>${app.executable}</executableName>
|
||||
<mainClass>${app.mainclass}</mainClass>
|
||||
<os>ios</os>
|
||||
<target>ios</target>
|
||||
<iosInfoPList>Info.plist.xml</iosInfoPList>
|
||||
<treeShaker>conservative</treeShaker>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>../assets</directory>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
<skipPngCrush>true</skipPngCrush>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>data</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<forceLinkClasses>
|
||||
<pattern>com.badlogic.gdx.scenes.scene2d.ui.*</pattern>
|
||||
<pattern>com.badlogic.gdx.graphics.g3d.particles.**</pattern>
|
||||
<pattern>com.android.okhttp.HttpHandler</pattern>
|
||||
<pattern>com.android.okhttp.HttpsHandler</pattern>
|
||||
<pattern>com.android.org.conscrypt.**</pattern>
|
||||
<pattern>com.android.org.bouncycastle.jce.provider.BouncyCastleProvider</pattern>
|
||||
<pattern>com.android.org.bouncycastle.jcajce.provider.keystore.BC$Mappings</pattern>
|
||||
<pattern>com.android.org.bouncycastle.jcajce.provider.keystore.bc.BcKeyStoreSpi</pattern>
|
||||
<pattern>com.android.org.bouncycastle.jcajce.provider.keystore.bc.BcKeyStoreSpi$Std</pattern>
|
||||
<pattern>com.android.org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi</pattern>
|
||||
<pattern>com.android.org.bouncycastle.crypto.digests.AndroidDigestFactoryOpenSSL</pattern>
|
||||
<pattern>org.apache.harmony.security.provider.cert.DRLCertFactory</pattern>
|
||||
<pattern>org.apache.harmony.security.provider.crypto.CryptoProvider</pattern>
|
||||
|
||||
|
||||
</forceLinkClasses>
|
||||
<libs>
|
||||
<lib>z</lib>
|
||||
</libs>
|
||||
<frameworks>
|
||||
<framework>UIKit</framework>
|
||||
|
||||
<framework>QuartzCore</framework>
|
||||
<framework>CoreGraphics</framework>
|
||||
<framework>OpenAL</framework>
|
||||
<framework>AudioToolbox</framework>
|
||||
<framework>AVFoundation</framework>
|
||||
<framework>GameController</framework>
|
||||
|
||||
</frameworks>
|
||||
</config>
|
||||
@@ -1,23 +0,0 @@
|
||||
package io.doppelspalt;
|
||||
|
||||
import org.robovm.apple.foundation.NSAutoreleasePool;
|
||||
import org.robovm.apple.uikit.UIApplication;
|
||||
|
||||
import com.badlogic.gdx.backends.iosrobovm.IOSApplication;
|
||||
import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration;
|
||||
import io.doppelspalt.Main;
|
||||
|
||||
/** Launches the iOS (RoboVM) application. */
|
||||
public class IOSLauncher extends IOSApplication.Delegate {
|
||||
@Override
|
||||
protected IOSApplication createApplication() {
|
||||
IOSApplicationConfiguration configuration = new IOSApplicationConfiguration();
|
||||
return new IOSApplication(new Main(), configuration);
|
||||
}
|
||||
|
||||
public static void main(String[] argv) {
|
||||
NSAutoreleasePool pool = new NSAutoreleasePool();
|
||||
UIApplication.main(argv, null, IOSLauncher.class);
|
||||
pool.close();
|
||||
}
|
||||
}
|
||||
@@ -1,68 +1,59 @@
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "io.github.fourlastor:construo:2.1.0"
|
||||
if(enableGraalNative == 'true') {
|
||||
classpath "org.graalvm.buildtools.native:org.graalvm.buildtools.native.gradle.plugin:0.9.28"
|
||||
// using jpackage only works if the JDK version is 14 or higher.
|
||||
// your JAVA_HOME environment variable may also need to be a JDK with version 14 or higher.
|
||||
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_14)) {
|
||||
classpath "org.beryx:badass-runtime-plugin:1.13.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
plugins {
|
||||
id "application"
|
||||
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_14)) {
|
||||
apply plugin: 'org.beryx.runtime'
|
||||
}
|
||||
else {
|
||||
apply plugin: 'application'
|
||||
}
|
||||
apply plugin: 'io.github.fourlastor.construo'
|
||||
|
||||
//sourceSets.main.resources.srcDirs += [ rootProject.file('assets').path ]
|
||||
sourceSets.main.resources.srcDirs += [ rootProject.file('assets') ]
|
||||
|
||||
import io.github.fourlastor.construo.Target
|
||||
|
||||
sourceSets.main.resources.srcDirs += [ rootProject.file('assets').path ]
|
||||
application.mainClass = 'io.doppelspalt.lwjgl3.Lwjgl3Launcher'
|
||||
application.applicationName = appName
|
||||
mainClassName = 'io.doppelspalt.lwjgl3.Lwjgl3Launcher'
|
||||
eclipse.project.name = appName + '-lwjgl3'
|
||||
java.sourceCompatibility = 11
|
||||
java.targetCompatibility = 11
|
||||
if (JavaVersion.current().isJava9Compatible()) {
|
||||
compileJava.options.release.set(11)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
|
||||
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
||||
|
||||
implementation "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
|
||||
implementation project(':core')
|
||||
|
||||
if(enableGraalNative == 'true') {
|
||||
implementation "io.github.berstanio:gdx-svmhelper-backend-lwjgl3:$graalHelperVersion"
|
||||
|
||||
}
|
||||
// Forces LWJGL3 to use at least $lwjgl3Version, currently 3.4.3, to avoid warnings on Java 25 and up.
|
||||
constraints{
|
||||
implementation("org.lwjgl:lwjgl:$lwjgl3Version")
|
||||
implementation("org.lwjgl:lwjgl-glfw:$lwjgl3Version")
|
||||
implementation("org.lwjgl:lwjgl-jemalloc:$lwjgl3Version")
|
||||
implementation("org.lwjgl:lwjgl-openal:$lwjgl3Version")
|
||||
implementation("org.lwjgl:lwjgl-opengl:$lwjgl3Version")
|
||||
implementation("org.lwjgl:lwjgl-stb:$lwjgl3Version")
|
||||
}
|
||||
}
|
||||
|
||||
def os = System.properties['os.name'].toLowerCase(Locale.ROOT)
|
||||
def os = System.properties['os.name'].toLowerCase()
|
||||
|
||||
run {
|
||||
workingDir = rootProject.file('assets').path
|
||||
// You can uncomment the next line if your IDE claims a build failure even when the app closed properly.
|
||||
//setIgnoreExitValue(true)
|
||||
jvmArgs += "--enable-native-access=ALL-UNNAMED"
|
||||
if (os.contains('mac')) jvmArgs += "-XstartOnFirstThread"
|
||||
setIgnoreExitValue(true)
|
||||
|
||||
// This next line could be needed to run LWJGL3 Java apps on macOS, but StartupHelper should make it unnecessary.
|
||||
//if (os.contains('mac')) jvmArgs += "-XstartOnFirstThread"
|
||||
// If you encounter issues with the 'lwjgl3:run' task on macOS specifically, try uncommenting the above line, and
|
||||
// regardless, please report it via the gdx-liftoff issue tracker or just mention it on the libGDX Discord.
|
||||
}
|
||||
|
||||
jar {
|
||||
// sets the name of the .jar file this produces to the name of the game or app, with the version after.
|
||||
archiveFileName.set("${appName}-${projectVersion}.jar")
|
||||
// sets the name of the .jar file this produces to the name of the game or app.
|
||||
archiveBaseName.set(appName)
|
||||
// using 'lib' instead of the default 'libs' appears to be needed by jpackageimage.
|
||||
destinationDirectory = file("${project.layout.buildDirectory.asFile.get().absolutePath}/lib")
|
||||
// the duplicatesStrategy matters starting in Gradle 7.0; this setting works.
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
|
||||
dependsOn configurations.runtimeClasspath
|
||||
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||
// these "exclude" lines remove some unnecessary duplicate files in the output JAR.
|
||||
@@ -71,10 +62,8 @@ jar {
|
||||
exclude('META-INF/INDEX.LIST', 'META-INF/maven/**')
|
||||
}
|
||||
// setting the manifest makes the JAR runnable.
|
||||
// enabling native access helps avoid a warning when Java 24 or later runs the JAR.
|
||||
// setting Multi-Release to true allows LWJGL3 to use different classes on recent Java versions.
|
||||
manifest {
|
||||
attributes 'Main-Class': application.mainClass, 'Enable-Native-Access': 'ALL-UNNAMED', 'Multi-Release': 'true'
|
||||
attributes 'Main-Class': project.mainClassName
|
||||
}
|
||||
// this last step may help on some OSes that need extra instruction to make runnable JARs.
|
||||
doLast {
|
||||
@@ -82,126 +71,43 @@ jar {
|
||||
}
|
||||
}
|
||||
|
||||
// Builds a JAR that only includes the files needed to run on macOS, not Windows or Linux.
|
||||
// The file size for a Mac-only JAR is about 7MB smaller than a cross-platform JAR.
|
||||
tasks.register("jarMac") {
|
||||
dependsOn("jar")
|
||||
group("build")
|
||||
jar.archiveFileName.set("${appName}-${projectVersion}-mac.jar")
|
||||
jar.exclude("windows/x86/**", "windows/x64/**", "linux/arm32/**", "linux/arm64/**", "linux/x64/**", "**/*.dll", "**/*.so",
|
||||
'META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA')
|
||||
dependencies {
|
||||
jar.exclude("windows/x86/**", "windows/x64/**", "linux/arm32/**", "linux/arm64/**", "linux/x64/**",
|
||||
'META-INF/INDEX.LIST', 'META-INF/maven/**')
|
||||
}
|
||||
}
|
||||
|
||||
// Builds a JAR that only includes the files needed to run on Linux, not Windows or macOS.
|
||||
// The file size for a Linux-only JAR is about 5MB smaller than a cross-platform JAR.
|
||||
tasks.register("jarLinux") {
|
||||
dependsOn("jar")
|
||||
group("build")
|
||||
jar.archiveFileName.set("${appName}-${projectVersion}-linux.jar")
|
||||
jar.exclude("windows/x86/**", "windows/x64/**", "macos/arm64/**", "macos/x64/**", "**/*.dll", "**/*.dylib",
|
||||
'META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA')
|
||||
dependencies {
|
||||
jar.exclude("windows/x86/**", "windows/x64/**", "macos/arm64/**", "macos/x64/**",
|
||||
'META-INF/INDEX.LIST', 'META-INF/maven/**')
|
||||
}
|
||||
}
|
||||
|
||||
// Builds a JAR that only includes the files needed to run on Windows, not Linux or macOS.
|
||||
// The file size for a Windows-only JAR is about 6MB smaller than a cross-platform JAR.
|
||||
tasks.register("jarWin") {
|
||||
dependsOn("jar")
|
||||
group("build")
|
||||
jar.archiveFileName.set("${appName}-${projectVersion}-win.jar")
|
||||
jar.exclude("macos/arm64/**", "macos/x64/**", "linux/arm32/**", "linux/arm64/**", "linux/x64/**", "**/*.dylib", "**/*.so",
|
||||
'META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA')
|
||||
dependencies {
|
||||
jar.exclude("macos/arm64/**", "macos/x64/**", "linux/arm32/**", "linux/arm64/**", "linux/x64/**",
|
||||
'META-INF/INDEX.LIST', 'META-INF/maven/**')
|
||||
}
|
||||
}
|
||||
|
||||
construo {
|
||||
// name of the executable
|
||||
name.set(appName)
|
||||
// human-readable name, used for example in the `.app` name for macOS
|
||||
humanName.set(appName)
|
||||
jlink {
|
||||
guessModulesFromJar.set(false)
|
||||
// You may need to add more modules, as needed.
|
||||
modules.addAll("java.base", "java.management", "java.desktop", "jdk.unsupported")
|
||||
}
|
||||
|
||||
targets.configure {
|
||||
register("linuxX64", Target.Linux) {
|
||||
architecture.set(Target.Architecture.X86_64)
|
||||
jdkUrl.set("https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.10%2B7/OpenJDK21U-jdk_x64_linux_hotspot_21.0.10_7.tar.gz")
|
||||
// Linux does not currently have a way to set the icon on the executable
|
||||
}
|
||||
register("macM1", Target.MacOs) {
|
||||
architecture.set(Target.Architecture.AARCH64)
|
||||
jdkUrl.set("https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.10%2B7/OpenJDK21U-jdk_aarch64_mac_hotspot_21.0.10_7.tar.gz")
|
||||
// macOS needs an identifier
|
||||
identifier.set("io.doppelspalt." + appName)
|
||||
// Optional: icon for macOS, as an ICNS file
|
||||
macIcon.set(project.file("icons/logo.icns"))
|
||||
}
|
||||
register("macX64", Target.MacOs) {
|
||||
architecture.set(Target.Architecture.X86_64)
|
||||
jdkUrl.set("https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.10%2B7/OpenJDK21U-jdk_x64_mac_hotspot_21.0.10_7.tar.gz")
|
||||
// macOS needs an identifier
|
||||
identifier.set("io.doppelspalt." + appName)
|
||||
// Optional: icon for macOS, as an ICNS file
|
||||
macIcon.set(project.file("icons/logo.icns"))
|
||||
}
|
||||
register("winX64", Target.Windows) {
|
||||
architecture.set(Target.Architecture.X86_64)
|
||||
// Optional: icon for Windows, as a PNG
|
||||
icon.set(project.file("icons/logo.png"))
|
||||
jdkUrl.set("https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.10%2B7/OpenJDK21U-jdk_x64_windows_hotspot_21.0.10_7.zip")
|
||||
// Uncomment the next line to show a console when the game runs, to print messages.
|
||||
//useConsole.set(true)
|
||||
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_14)) {
|
||||
tasks.jpackageImage.doNotTrackState("This task both reads from and writes to the build folder.")
|
||||
runtime {
|
||||
options.set(['--strip-debug',
|
||||
'--compress', '2',
|
||||
'--no-header-files',
|
||||
'--no-man-pages',
|
||||
'--strip-native-commands',
|
||||
'--vm', 'server'])
|
||||
// you could very easily need more modules than this one.
|
||||
// use the lwjgl3:suggestModules task to see which modules may be needed.
|
||||
modules.set([
|
||||
'jdk.unsupported'
|
||||
])
|
||||
distDir.set(file(project.layout.buildDirectory))
|
||||
jpackage {
|
||||
imageName = appName
|
||||
// you can set this to false if you want to build an installer, or keep it as true to build just an app.
|
||||
skipInstaller = true
|
||||
// this may need to be set to a different path if your JAVA_HOME points to a low JDK version.
|
||||
jpackageHome = javaHome.getOrElse("")
|
||||
mainJar = jar.archiveFileName.get()
|
||||
if (os.contains('win')) {
|
||||
imageOptions = ["--icon", "icons/logo.ico"]
|
||||
} else if (os.contains('nix') || os.contains('nux') || os.contains('bsd')) {
|
||||
imageOptions = ["--icon", "icons/logo.png"]
|
||||
} else if (os.contains('mac')) {
|
||||
// If you are making a jpackage image on macOS, the below line should work thanks to StartupHelper.
|
||||
imageOptions = ["--icon", "icons/logo.icns"]
|
||||
// If the above line doesn't produce a runnable executable, you can try using the below line instead of the above one.
|
||||
// imageOptions = ["--icon", "icons/logo.icns", "--java-options", "\"-XstartOnFirstThread\""]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Equivalent to the jar task; here for compatibility with gdx-setup.
|
||||
tasks.register('dist') {
|
||||
dependsOn 'jar'
|
||||
dependsOn['jar']
|
||||
}
|
||||
|
||||
distributions {
|
||||
main {
|
||||
contents {
|
||||
into('libs') {
|
||||
project.configurations.runtimeClasspath.files.findAll { file ->
|
||||
file.getName() != project.tasks.jar.outputs.files.singleFile.name
|
||||
}.each { file ->
|
||||
exclude file.name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
startScripts.dependsOn(':lwjgl3:jar')
|
||||
startScripts.classpath = project.tasks.jar.outputs.files
|
||||
|
||||
// Helps if debugging on Linux with an Nvidia GPU.
|
||||
// This means StartupHelper won't try to restart the JVM, which can prevent debugging.
|
||||
// This only applies to Gradle tasks, not main methods debugged when launching a main() method directly.
|
||||
// As a more general solution, set the environment variable __GL_THREADED_OPTIMIZATIONS to 0 globally, on Linux
|
||||
// machines with Nvidia GPUs where you need to debug LWJGL3 apps and games.
|
||||
// You can also set __GL_THREADED_OPTIMIZATIONS to 0 in run configurations, which you would need per main() method.
|
||||
// StartupHelper will still restart the JVM to set this environment variable when run as a distributable JAR, which is
|
||||
// a good thing for end users. They won't need to ever set the debug-specific environment variable.
|
||||
tasks.withType(JavaExec.class).configureEach {
|
||||
environment("__GL_THREADED_OPTIMIZATIONS", 0)
|
||||
}
|
||||
|
||||
if(enableGraalNative == 'true') {
|
||||
apply from: file("nativeimage.gradle")
|
||||
}
|
||||
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.5 KiB |
@@ -1,54 +0,0 @@
|
||||
|
||||
project(":lwjgl3") {
|
||||
apply plugin: "org.graalvm.buildtools.native"
|
||||
|
||||
graalvmNative {
|
||||
binaries {
|
||||
main {
|
||||
imageName = appName
|
||||
mainClass = application.mainClass
|
||||
requiredVersion = '23.0'
|
||||
buildArgs.add("-march=compatibility")
|
||||
jvmArgs.addAll("-Dfile.encoding=UTF8")
|
||||
sharedLibrary = false
|
||||
resources.autodetect()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
run {
|
||||
doNotTrackState("Running the app should not be affected by Graal.")
|
||||
}
|
||||
|
||||
// Modified from https://lyze.dev/2021/04/29/libGDX-Internal-Assets-List/ ; thanks again, Lyze!
|
||||
// This creates a resource-config.json file based on the contents of the assets folder (and the libGDX icons).
|
||||
// This file is used by Graal Native to embed those specific files.
|
||||
// This has to run before nativeCompile, so it runs at the start of an unrelated resource-handling command.
|
||||
generateResourcesConfigFile.doFirst {
|
||||
def assetsFolder = new File("${project.rootDir}/assets/")
|
||||
def lwjgl3 = project(':lwjgl3')
|
||||
def resFolder = new File("${lwjgl3.projectDir}/src/main/resources/META-INF/native-image/${lwjgl3.ext.appName}")
|
||||
resFolder.mkdirs()
|
||||
def resFile = new File(resFolder, "resource-config.json")
|
||||
resFile.delete()
|
||||
resFile.append(
|
||||
"""{
|
||||
"resources":{
|
||||
"includes":[
|
||||
{
|
||||
"pattern": ".*(""")
|
||||
// This adds every filename in the assets/ folder to a pattern that adds those files as resources.
|
||||
fileTree(assetsFolder).each {
|
||||
// The backslash-Q and backslash-E escape the start and end of a literal string, respectively.
|
||||
resFile.append("\\\\Q${it.name}\\\\E|")
|
||||
}
|
||||
// We also match all of the window icon images this way and the font files that are part of libGDX.
|
||||
resFile.append(
|
||||
"""libgdx.+\\\\.png|lsans.+)"
|
||||
}
|
||||
]},
|
||||
"bundles":[]
|
||||
}"""
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -18,31 +18,14 @@ public class Lwjgl3Launcher {
|
||||
private static Lwjgl3ApplicationConfiguration getDefaultConfiguration() {
|
||||
Lwjgl3ApplicationConfiguration configuration = new Lwjgl3ApplicationConfiguration();
|
||||
configuration.setTitle("Doppelspalt");
|
||||
//// Vsync limits the frames per second to what your hardware can display, and helps eliminate
|
||||
//// screen tearing. This setting doesn't always work on Linux, so the line after is a safeguard.
|
||||
configuration.useVsync(true);
|
||||
//// Limits FPS to the refresh rate of the currently active monitor, plus 1 to try to match fractional
|
||||
//// refresh rates. The Vsync setting above should limit the actual FPS to match the monitor.
|
||||
configuration.setForegroundFPS(Lwjgl3ApplicationConfiguration.getDisplayMode().refreshRate + 1);
|
||||
//// Limits FPS to the refresh rate of the currently active monitor.
|
||||
configuration.setForegroundFPS(Lwjgl3ApplicationConfiguration.getDisplayMode().refreshRate);
|
||||
//// If you remove the above line and set Vsync to false, you can get unlimited FPS, which can be
|
||||
//// useful for testing performance, but can also be very stressful to some hardware.
|
||||
//// You may also need to configure GPU drivers to fully disable Vsync; this can cause screen tearing.
|
||||
|
||||
configuration.setWindowedMode(640, 480);
|
||||
//// You can change these files; they are in lwjgl3/src/main/resources/ .
|
||||
//// They can also be loaded from the root of assets/ .
|
||||
configuration.setWindowIcon("libgdx128.png", "libgdx64.png", "libgdx32.png", "libgdx16.png");
|
||||
|
||||
//// This could improve compatibility with Windows machines with buggy OpenGL drivers, Macs
|
||||
//// with Apple Silicon that have to emulate compatibility with OpenGL anyway, and more.
|
||||
//// This uses the dependency `com.badlogicgames.gdx:gdx-lwjgl3-angle` to function.
|
||||
//// You would need to add this line to lwjgl3/build.gradle , below the dependency on `gdx-backend-lwjgl3`:
|
||||
//// implementation "com.badlogicgames.gdx:gdx-lwjgl3-angle:$gdxVersion"
|
||||
//// You can choose to add the following line and the mentioned dependency if you want; they
|
||||
//// are not intended for games that use GL30 (which is compatibility with OpenGL ES 3.0).
|
||||
//// Know that it might not work well in some cases.
|
||||
// configuration.setOpenGLEmulation(Lwjgl3ApplicationConfiguration.GLEmulation.ANGLE_GLES20, 0, 0);
|
||||
|
||||
return configuration;
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@@ -12,216 +12,168 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Note, the above license and copyright applies to this file only.
|
||||
//Note, the above license and copyright applies to this file only.
|
||||
|
||||
package io.doppelspalt.lwjgl3;
|
||||
|
||||
import com.badlogic.gdx.Version;
|
||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3NativesLoader;
|
||||
|
||||
import org.lwjgl.system.JNI;
|
||||
import org.lwjgl.system.linux.UNISTD;
|
||||
import org.lwjgl.system.macosx.LibC;
|
||||
import org.lwjgl.system.macosx.ObjCRuntime;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* A helper object for game startup, featuring three utilities related to LWJGL3 on various operating systems.
|
||||
* <p>
|
||||
* The utilities are as follows:
|
||||
* <ul>
|
||||
* <li> Windows: Prevents a common crash related to LWJGL3's extraction of shared library files.</li>
|
||||
* <li> macOS: Spawns a child JVM process with {@code -XstartOnFirstThread} in the JVM args (if it was not already).
|
||||
* This is required for LWJGL3 to work on macOS.</li>
|
||||
* <li> Linux (NVIDIA GPUs only): Spawns a child JVM process with the {@code __GL_THREADED_OPTIMIZATIONS}
|
||||
* {@link System#getenv(String) Environment Variable} set to {@code 0} (if it was not already). This is required for
|
||||
* LWJGL3 to work on Linux with NVIDIA GPUs.</li>
|
||||
* </ul>
|
||||
* Adds some utilities to ensure that the JVM was started with the
|
||||
* {@code -XstartOnFirstThread} argument, which is required on macOS for LWJGL 3
|
||||
* to function. Also helps on Windows when users have names with characters from
|
||||
* outside the Latin alphabet, a common cause of startup crashes.
|
||||
* <br>
|
||||
* <a href="https://jvm-gaming.org/t/starting-jvm-on-mac-with-xstartonfirstthread-programmatically/57547">Based on this java-gaming.org post by kappa</a>
|
||||
* @author damios
|
||||
*/
|
||||
public class StartupHelper {
|
||||
|
||||
private StartupHelper() {}
|
||||
private static final String JVM_RESTARTED_ARG = "jvmIsRestarted";
|
||||
|
||||
private static final String JVM_RESTARTED_ARG = "jvmIsRestarted";
|
||||
private StartupHelper() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Must only be called on Linux. Check OS first (or use short-circuit evaluation)!
|
||||
* @return whether NVIDIA drivers are present on Linux.
|
||||
*/
|
||||
public static boolean isLinuxNvidia() {
|
||||
String[] drivers = new File("/proc/driver").list(
|
||||
(dir, path) -> path.toUpperCase(Locale.ROOT).contains("NVIDIA")
|
||||
);
|
||||
if (drivers == null) return false;
|
||||
return drivers.length > 0;
|
||||
}
|
||||
/**
|
||||
* Starts a new JVM if the application was started on macOS without the
|
||||
* {@code -XstartOnFirstThread} argument. This also includes some code for
|
||||
* Windows, for the case where the user's home directory includes certain
|
||||
* non-Latin-alphabet characters (without this code, most LWJGL3 apps fail
|
||||
* immediately for those users). Returns whether a new JVM was started and
|
||||
* thus no code should be executed.
|
||||
* <p>
|
||||
* <u>Usage:</u>
|
||||
*
|
||||
* <pre><code>
|
||||
* public static void main(String... args) {
|
||||
* if (StartupHelper.startNewJvmIfRequired(true)) return; // This handles macOS support and helps on Windows.
|
||||
* // after this is the actual main method code
|
||||
* }
|
||||
* </code></pre>
|
||||
*
|
||||
* @param redirectOutput
|
||||
* whether the output of the new JVM should be rerouted to the
|
||||
* old JVM, so it can be accessed in the same place; keeps the
|
||||
* old JVM running if enabled
|
||||
* @return whether a new JVM was started and thus no code should be executed
|
||||
* in this one
|
||||
*/
|
||||
public static boolean startNewJvmIfRequired(boolean redirectOutput) {
|
||||
String osName = System.getProperty("os.name").toLowerCase();
|
||||
if (!osName.contains("mac")) {
|
||||
if (osName.contains("windows")) {
|
||||
// Here, we are trying to work around an issue with how LWJGL3 loads its extracted .dll files.
|
||||
// By default, LWJGL3 extracts to the directory specified by "java.io.tmpdir", which is usually the user's home.
|
||||
// If the user's name has non-ASCII (or some non-alphanumeric) characters in it, that would fail.
|
||||
// By extracting to the relevant "ProgramData" folder, which is usually "C:\ProgramData", we avoid this.
|
||||
System.setProperty("java.io.tmpdir", System.getenv("ProgramData") + "/libGDX-temp");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the utilities as described by {@link StartupHelper}'s Javadoc.
|
||||
* <p>
|
||||
* All {@link System#getenv() Environment Variables} are copied to the child JVM process (if it is spawned), as
|
||||
* specified by {@link ProcessBuilder#environment()}; the same applies for
|
||||
* {@link System#getProperties() System Properties}.
|
||||
* <p>
|
||||
* <b>Usage:</b>
|
||||
* <pre><code>
|
||||
* public static void main(String[] args) {
|
||||
* if (StartupHelper.startNewJvmIfRequired()) return;
|
||||
* // ... The rest of main() goes here, as normal.
|
||||
* }
|
||||
* </code></pre>
|
||||
* @return whether a child JVM process was spawned or not.
|
||||
*/
|
||||
public static boolean startNewJvmIfRequired() {
|
||||
return startNewJvmIfRequired(true);
|
||||
}
|
||||
// There is no need for -XstartOnFirstThread on Graal native image
|
||||
if (!System.getProperty("org.graalvm.nativeimage.imagecode", "").isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the utilities as described by {@link StartupHelper}'s Javadoc.
|
||||
* <p>
|
||||
* All {@link System#getenv() Environment Variables} are copied to the child JVM process (if it is spawned), as
|
||||
* specified by {@link ProcessBuilder#environment()}; the same applies for
|
||||
* {@link System#getProperties() System Properties}.
|
||||
* <p>
|
||||
* <b>Usage:</b>
|
||||
* <pre><code>
|
||||
* public static void main(String[] args) {
|
||||
* // The parameter on the next line could instead be false if you don't want to inherit IO.
|
||||
* if (StartupHelper.startNewJvmIfRequired(true)) return;
|
||||
* // ... The rest of main() goes here, as normal.
|
||||
* }
|
||||
* </code></pre>
|
||||
* @param inheritIO whether I/O should be inherited in the child JVM process. Please note that enabling this will
|
||||
* block the thread until the child JVM process stops executing.
|
||||
* @return whether a child JVM process was spawned or not.
|
||||
*/
|
||||
public static boolean startNewJvmIfRequired(boolean inheritIO) {
|
||||
String osName = System.getProperty("os.name").toLowerCase(Locale.ROOT);
|
||||
if (osName.contains("mac")) return startNewJvm0(/*isMac =*/ true, inheritIO);
|
||||
if (osName.contains("windows")) {
|
||||
// Here, we are trying to work around an issue with how LWJGL3 loads its extracted .dll files.
|
||||
// By default, LWJGL3 extracts to the directory specified by "java.io.tmpdir": usually, the user's home.
|
||||
// If the user's name has non-ASCII (or some non-alphanumeric) characters in it, that would fail.
|
||||
// By extracting to the relevant "ProgramData" folder, which is usually "C:\ProgramData", we avoid this.
|
||||
// We also temporarily change the "user.name" property to one without any chars that would be invalid.
|
||||
// We revert our changes immediately after loading LWJGL3 natives.
|
||||
String programData = System.getenv("ProgramData");
|
||||
if (programData == null) programData = "C:\\Temp"; // if ProgramData isn't set, try some fallback.
|
||||
String prevTmpDir = System.getProperty("java.io.tmpdir", programData);
|
||||
String prevUser = System.getProperty("user.name", "libGDX_User");
|
||||
System.setProperty("java.io.tmpdir", programData + "\\libGDX-temp");
|
||||
System.setProperty(
|
||||
"user.name",
|
||||
("User_" + prevUser.hashCode() + "_GDX" + Version.VERSION).replace('.', '_')
|
||||
);
|
||||
Lwjgl3NativesLoader.load();
|
||||
System.setProperty("java.io.tmpdir", prevTmpDir);
|
||||
System.setProperty("user.name", prevUser);
|
||||
return false;
|
||||
}
|
||||
return startNewJvm0(/*isMac =*/ false, inheritIO);
|
||||
}
|
||||
long pid = LibC.getpid();
|
||||
|
||||
private static final String MAC_JRE_ERR_MSG = "A Java installation could not be found. If you are distributing this app with a bundled JRE, be sure to set the '-XstartOnFirstThread' argument manually!";
|
||||
private static final String LINUX_JRE_ERR_MSG = "A Java installation could not be found. If you are distributing this app with a bundled JRE, be sure to set the environment variable '__GL_THREADED_OPTIMIZATIONS' to '0'!";
|
||||
private static final String CHILD_LOOP_ERR_MSG = "The current JVM process is a spawned child JVM process, but StartupHelper has attempted to spawn another child JVM process! This is a broken state, and should not normally happen! Your game may crash or not function properly!";
|
||||
// check whether -XstartOnFirstThread is enabled
|
||||
if ("1".equals(System.getenv("JAVA_STARTED_ON_FIRST_THREAD_" + pid))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawns a child JVM process if on macOS, or on Linux with NVIDIA drivers.
|
||||
* <p>
|
||||
* All {@link System#getenv() Environment Variables} are copied to the child JVM process (if it is spawned), as
|
||||
* specified by {@link ProcessBuilder#environment()}; the same applies for
|
||||
* {@link System#getProperties() System Properties}.
|
||||
* @param isMac whether the current OS is macOS. If this is `false` then the current OS is assumed to be Linux (and
|
||||
* an immediate check for NVIDIA drivers is performed).
|
||||
* @param inheritIO whether I/O should be inherited in the child JVM process. Please note that enabling this will
|
||||
* block the thread until the child JVM process stops executing.
|
||||
* @return whether a child JVM process was spawned or not.
|
||||
*/
|
||||
public static boolean startNewJvm0(boolean isMac, boolean inheritIO) {
|
||||
long processID = getProcessID(isMac);
|
||||
if (!isMac) {
|
||||
// No need to restart non-NVIDIA Linux
|
||||
if (!isLinuxNvidia()) return false;
|
||||
// check whether __GL_THREADED_OPTIMIZATIONS is already disabled
|
||||
if ("0".equals(System.getenv("__GL_THREADED_OPTIMIZATIONS"))) return false;
|
||||
} else {
|
||||
// There is no need for -XstartOnFirstThread on Graal native image
|
||||
if (!System.getProperty("org.graalvm.nativeimage.imagecode", "").isEmpty()) return false;
|
||||
// check whether the JVM was previously restarted
|
||||
// avoids looping, but most certainly leads to a crash
|
||||
if ("true".equals(System.getProperty(JVM_RESTARTED_ARG))) {
|
||||
System.err.println(
|
||||
"There was a problem evaluating whether the JVM was started with the -XstartOnFirstThread argument.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Checks if we are already on the main thread, such as from running via Construo.
|
||||
long objcMsgSend = ObjCRuntime.getLibrary().getFunctionAddress("objc_msgSend");
|
||||
long nsThread = ObjCRuntime.objc_getClass("NSThread");
|
||||
long currentThread = JNI.invokePPP(nsThread, ObjCRuntime.sel_getUid("currentThread"), objcMsgSend);
|
||||
boolean isMainThread = JNI.invokePPZ(currentThread, ObjCRuntime.sel_getUid("isMainThread"), objcMsgSend);
|
||||
if (isMainThread) return false;
|
||||
// Restart the JVM with -XstartOnFirstThread
|
||||
ArrayList<String> jvmArgs = new ArrayList<>();
|
||||
String separator = System.getProperty("file.separator");
|
||||
// The following line is used assuming you target Java 8, the minimum for LWJGL3.
|
||||
String javaExecPath = System.getProperty("java.home") + separator + "bin" + separator + "java";
|
||||
// If targeting Java 9 or higher, you could use the following instead of the above line:
|
||||
//String javaExecPath = ProcessHandle.current().info().command().orElseThrow();
|
||||
|
||||
if ("1".equals(System.getenv("JAVA_STARTED_ON_FIRST_THREAD_" + processID))) return false;
|
||||
}
|
||||
if (!(new File(javaExecPath)).exists()) {
|
||||
System.err.println(
|
||||
"A Java installation could not be found. If you are distributing this app with a bundled JRE, be sure to set the -XstartOnFirstThread argument manually!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check whether this JVM process is a child JVM process already.
|
||||
// This state shouldn't usually be reachable, but this stops us from endlessly spawning new child JVM processes.
|
||||
if ("true".equals(System.getProperty(JVM_RESTARTED_ARG))) {
|
||||
System.err.println(CHILD_LOOP_ERR_MSG);
|
||||
return false;
|
||||
}
|
||||
jvmArgs.add(javaExecPath);
|
||||
jvmArgs.add("-XstartOnFirstThread");
|
||||
jvmArgs.add("-D" + JVM_RESTARTED_ARG + "=true");
|
||||
jvmArgs.addAll(ManagementFactory.getRuntimeMXBean().getInputArguments());
|
||||
jvmArgs.add("-cp");
|
||||
jvmArgs.add(System.getProperty("java.class.path"));
|
||||
String mainClass = System.getenv("JAVA_MAIN_CLASS_" + pid);
|
||||
if (mainClass == null) {
|
||||
StackTraceElement[] trace = Thread.currentThread().getStackTrace();
|
||||
if (trace.length > 0) {
|
||||
mainClass = trace[trace.length - 1].getClassName();
|
||||
} else {
|
||||
System.err.println("The main class could not be determined.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
jvmArgs.add(mainClass);
|
||||
|
||||
// Spawn the child JVM process with updated environment variables or JVM args
|
||||
List<String> jvmArgs = new ArrayList<>();
|
||||
// The following line is used assuming you target Java 8, the minimum for LWJGL3.
|
||||
String javaExecPath = System.getProperty("java.home") + "/bin/java";
|
||||
// If targeting Java 9 or higher, you could use the following instead of the above line:
|
||||
//String javaExecPath = ProcessHandle.current().info().command().orElseThrow()
|
||||
if (!(new File(javaExecPath).exists())) {
|
||||
System.err.println(getJreErrMsg(isMac));
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
if (!redirectOutput) {
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(jvmArgs);
|
||||
processBuilder.start();
|
||||
} else {
|
||||
Process process = (new ProcessBuilder(jvmArgs))
|
||||
.redirectErrorStream(true).start();
|
||||
BufferedReader processOutput = new BufferedReader(
|
||||
new InputStreamReader(process.getInputStream()));
|
||||
String line;
|
||||
|
||||
jvmArgs.add(javaExecPath);
|
||||
if (isMac) jvmArgs.add("-XstartOnFirstThread");
|
||||
jvmArgs.add("-D" + JVM_RESTARTED_ARG + "=true");
|
||||
jvmArgs.addAll(ManagementFactory.getRuntimeMXBean().getInputArguments());
|
||||
jvmArgs.add("-cp");
|
||||
jvmArgs.add(System.getProperty("java.class.path"));
|
||||
String mainClass = System.getenv("JAVA_MAIN_CLASS_" + processID);
|
||||
if (mainClass == null) {
|
||||
StackTraceElement[] trace = Thread.currentThread().getStackTrace();
|
||||
if (trace.length > 0) mainClass = trace[trace.length - 1].getClassName();
|
||||
else {
|
||||
System.err.println("The main class could not be determined.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
jvmArgs.add(mainClass);
|
||||
while ((line = processOutput.readLine()) != null) {
|
||||
System.out.println(line);
|
||||
}
|
||||
|
||||
try {
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(jvmArgs);
|
||||
if (!isMac) processBuilder.environment().put("__GL_THREADED_OPTIMIZATIONS", "0");
|
||||
process.waitFor();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println("There was a problem restarting the JVM");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (!inheritIO) processBuilder.start();
|
||||
else processBuilder.inheritIO().start().waitFor();
|
||||
} catch (Exception e) {
|
||||
System.err.println("There was a problem restarting the JVM.");
|
||||
// noinspection CallToPrintStackTrace
|
||||
e.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static String getJreErrMsg(boolean isMac) {
|
||||
if (isMac) return MAC_JRE_ERR_MSG;
|
||||
else return LINUX_JRE_ERR_MSG;
|
||||
}
|
||||
|
||||
private static long getProcessID(boolean isMac) {
|
||||
if (isMac) return LibC.getpid();
|
||||
else return UNISTD.getpid();
|
||||
}
|
||||
/**
|
||||
* Starts a new JVM if the application was started on macOS without the
|
||||
* {@code -XstartOnFirstThread} argument. Returns whether a new JVM was
|
||||
* started and thus no code should be executed. Redirects the output of the
|
||||
* new JVM to the old one.
|
||||
* <p>
|
||||
* <u>Usage:</u>
|
||||
*
|
||||
* <pre>
|
||||
* public static void main(String... args) {
|
||||
* if (StartupHelper.startNewJvmIfRequired()) return; // This handles macOS support and helps on Windows.
|
||||
* // the actual main method code
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @return whether a new JVM was started and thus no code should be executed
|
||||
* in this one
|
||||
*/
|
||||
public static boolean startNewJvmIfRequired() {
|
||||
return startNewJvmIfRequired(true);
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.5 KiB |
|
Before Width: | Height: | Size: 806 B After Width: | Height: | Size: 879 B |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.9 KiB |
@@ -1,8 +1 @@
|
||||
plugins {
|
||||
// Applies the foojay-resolver plugin to allow automatic download of JDKs.
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
|
||||
}
|
||||
// A list of which subprojects to load as part of the same larger project.
|
||||
// You can remove Strings from the list and reload the Gradle project
|
||||
// if you want to temporarily disable a subproject.
|
||||
include 'lwjgl3', 'ios', 'teavm', 'core'
|
||||
include 'html', 'core', 'lwjgl3'
|
||||
@@ -1,66 +0,0 @@
|
||||
import org.teavm.gradle.api.OptimizationLevel
|
||||
|
||||
plugins {
|
||||
id 'java'
|
||||
id("com.github.xpenatan.gdx-teavm") version "$gdxTeaVMVersion"
|
||||
}
|
||||
|
||||
eclipse.project.name = appName + "-teavm"
|
||||
|
||||
// This must be at least 17, and no lower than the JDK version this project is built with.
|
||||
java.targetCompatibility = "17"
|
||||
// This should probably be equal to targetCompatibility, above. This only affects the TeaVM module.
|
||||
java.sourceCompatibility = "17"
|
||||
|
||||
dependencies {
|
||||
implementation "com.github.xpenatan.gdx-teavm:backend-web:$gdxTeaVMVersion"
|
||||
implementation project(':core')
|
||||
|
||||
}
|
||||
|
||||
/// The tasks set up for debugging are gdx_teavm_web_js_build and gdx_teavm_web_js_run .
|
||||
/// These auto-build and reload changed sources; they don't obfuscate their output.
|
||||
/// The tasks for releases are gdx_teavm_web_js_release_build, gdx_teavm_web_js_release_run,
|
||||
/// gdx_teavm_web_wasm_release_build, and gdx_teavm_web_wasm_release_run .
|
||||
/// The build tasks will place a build in build/dist/js/release/webapp or build/dist/wasm/release/webapp .
|
||||
/// The run tasks (including debug) will provide a link to click in the build output.
|
||||
/// The run tasks won't end on their own; you can open the link multiple times until you stop the build.
|
||||
|
||||
gdxTeaVM {
|
||||
assets.from(rootProject.files('assets'))
|
||||
|
||||
/// You can add additional classes or packages that need reflection here.
|
||||
//reflection.add("io.doppelspalt.reflect")
|
||||
|
||||
webDefaults {
|
||||
mainClass.set("io.doppelspalt.teavm.TeaVMLauncher")
|
||||
htmlTitle.set(appName)
|
||||
}
|
||||
|
||||
js {
|
||||
devServer {
|
||||
enabled.set(true)
|
||||
autoBuild.set(true)
|
||||
autoReload.set(true)
|
||||
optimization.set(OptimizationLevel.NONE)
|
||||
}
|
||||
}
|
||||
|
||||
js("release") {
|
||||
obfuscated.set(true)
|
||||
serverPort.set(8180)
|
||||
optimization.set(OptimizationLevel.BALANCED)
|
||||
}
|
||||
|
||||
wasm("release") {
|
||||
obfuscated.set(true)
|
||||
serverPort.set(8181)
|
||||
optimization.set(OptimizationLevel.BALANCED)
|
||||
}
|
||||
}
|
||||
|
||||
// For backwards compatibility with the earlier run and build tasks.
|
||||
tasks.register("run"){
|
||||
dependsOn("gdx_teavm_web_wasm_release_run")
|
||||
}
|
||||
build.dependsOn("gdx_teavm_web_wasm_release_build")
|
||||
@@ -1,21 +0,0 @@
|
||||
package io.doppelspalt.teavm;
|
||||
|
||||
import com.github.xpenatan.gdx.teavm.backends.web.WebApplicationConfiguration;
|
||||
import com.github.xpenatan.gdx.teavm.backends.web.WebApplication;
|
||||
import io.doppelspalt.Main;
|
||||
|
||||
/**
|
||||
* Launches the TeaVM/HTML application.
|
||||
*/
|
||||
public class TeaVMLauncher {
|
||||
public static void main(String[] args) {
|
||||
WebApplicationConfiguration config = new WebApplicationConfiguration("canvas");
|
||||
//// If width and height are each greater than 0, then the app will use a fixed size.
|
||||
//config.width = 640;
|
||||
//config.height = 480;
|
||||
//// If width and height are both 0, then the app will use all available space.
|
||||
config.width = 0;
|
||||
config.height = 0;
|
||||
new WebApplication(new Main(), config);
|
||||
}
|
||||
}
|
||||