Compare commits

...

11 Commits

Author SHA1 Message Date
minjaesong
5ad352d8cf COPYING update 2026-05-22 22:28:38 +09:00
minjaesong
426f0b0aab blending fix 2026-05-17 13:03:55 +09:00
minjaesong
b01d1683b7 contextual darkening of ui 2026-05-17 12:42:20 +09:00
minjaesong
b547914865 long overdue JVM tuning 2026-04-27 17:57:00 +09:00
minjaesong
c3c6f70e38 wtf? 2026-04-25 15:50:16 +09:00
minjaesong
8824bad9bf Graal update 2026-04-20 17:34:07 +09:00
minjaesong
9edf3a6573 better splash 2026-04-06 11:11:36 +09:00
minjaesong
f3fb8a96f0 more interesting splash screen wip 2026-04-06 02:05:05 +09:00
minjaesong
281146dd92 title screen fade 2026-04-06 01:40:06 +09:00
minjaesong
8eff89a7cb fix: inputstrober not working 2026-04-04 22:59:30 +09:00
minjaesong
73c7c8942e title screen fade-in transition 2026-04-04 22:33:10 +09:00
94 changed files with 616 additions and 256 deletions

View File

@@ -25,12 +25,20 @@
<element id="extracted-dir" path="$KOTLIN_BUNDLED$/lib/kotlin-stdlib-jdk8.jar" path-in-jar="/" />
<element id="extracted-dir" path="$KOTLIN_BUNDLED$/lib/kotlin-stdlib-jdk7.jar" path-in-jar="/" />
<element id="extracted-dir" path="$KOTLIN_BUNDLED$/lib/kotlin-reflect.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/graal-sdk-22.3.1.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/icu4j-71.1.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/js-22.3.1-edit.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/js-scriptengine-22.3.1.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/regex-22.3.1-edit.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/truffle-api-22.3.1.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/polyglot-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/js-language-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/js-scriptengine-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/regex-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/truffle-api-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/truffle-runtime-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/truffle-compiler-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/compiler-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/compiler-management-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/icu4j-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/collections-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/word-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/nativeimage-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/jniutils-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/gdx-1.12.1.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/gdx-backend-lwjgl3-1.12.1.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/lwjgl-3.3.3.jar" path-in-jar="/" />

View File

@@ -18,12 +18,20 @@
<element id="extracted-dir" path="$PROJECT_DIR$/lib/Terrarum_Joise.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/TerrarumSansBitmap.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/gdx-jnigen-loader-2.3.1.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/js-scriptengine-22.3.1.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/truffle-api-22.3.1.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/icu4j-71.1.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/regex-22.3.1-edit.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/js-22.3.1-edit.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/graal-sdk-22.3.1.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/polyglot-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/js-language-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/js-scriptengine-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/regex-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/truffle-api-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/truffle-runtime-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/truffle-compiler-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/compiler-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/compiler-management-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/icu4j-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/collections-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/word-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/nativeimage-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/jniutils-23.1.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/commons-math3-3.6.1.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/JTransforms-3.1.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/JLargeArrays-1.5.jar" path-in-jar="/" />

23
.idea/csv-editor.xml generated
View File

@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CsvFileAttributes">
<option name="attributeMap">
<map>
<entry key="/Terrarum.wiki/Items.md">
<value>
<Attribute>
<option name="separator" value="," />
</Attribute>
</value>
</entry>
<entry key="/Terrarum.wiki/Modules:Setup.md">
<value>
<Attribute>
<option name="separator" value="," />
</Attribute>
</value>
</entry>
</map>
</option>
</component>
</project>

View File

@@ -1,28 +1,52 @@
<component name="libraryTable">
<library name="graalvm-js 22.3.1">
<library name="graalvm-js 23.1.10">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/graal-sdk-22.3.1.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/icu4j-71.1.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/js-22.3.1-edit.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/js-scriptengine-22.3.1.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/regex-22.3.1-edit.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/truffle-api-22.3.1.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/polyglot-23.1.10.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/icu4j-23.1.10.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/js-language-23.1.10.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/js-scriptengine-23.1.10.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/regex-23.1.10.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/truffle-api-23.1.10.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/truffle-runtime-23.1.10.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/truffle-compiler-23.1.10.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/compiler-23.1.10.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/compiler-management-23.1.10.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/collections-23.1.10.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/word-23.1.10.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/nativeimage-23.1.10.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/jniutils-23.1.10.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$PROJECT_DIR$/lib/graal-sdk-22.3.1-javadoc.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/icu4j-71.1-javadoc.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/js-22.3.1-javadoc.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/js-scriptengine-22.3.1-javadoc.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/regex-22.3.1-javadoc.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/truffle-api-22.3.1-javadoc.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/polyglot-23.1.10-javadoc.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/icu4j-23.1.10-javadoc.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/js-language-23.1.10-javadoc.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/js-scriptengine-23.1.10-javadoc.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/regex-23.1.10-javadoc.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/truffle-api-23.1.10-javadoc.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/truffle-runtime-23.1.10-javadoc.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/truffle-compiler-23.1.10-javadoc.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/compiler-23.1.10-javadoc.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/compiler-management-23.1.10-javadoc.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/collections-23.1.10-javadoc.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/word-23.1.10-javadoc.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/nativeimage-23.1.10-javadoc.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/jniutils-23.1.10-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/graal-sdk-22.3.1-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/icu4j-71.1-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/js-22.3.1-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/js-scriptengine-22.3.1-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/regex-22.3.1-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/truffle-api-22.3.1-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/polyglot-23.1.10-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/icu4j-23.1.10-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/js-language-23.1.10-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/js-scriptengine-23.1.10-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/regex-23.1.10-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/truffle-api-23.1.10-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/truffle-runtime-23.1.10-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/truffle-compiler-23.1.10-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/compiler-23.1.10-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/compiler-management-23.1.10-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/collections-23.1.10-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/word-23.1.10-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/nativeimage-23.1.10-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/jniutils-23.1.10-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="SpriteAssemblerApp" type="JarApplication">
<option name="JAR_PATH" value="$PROJECT_DIR$/out/SpriteAssemblerApp.jar" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="VM_PARAMETERS" value="-ea --upgrade-module-path=lib/compiler-23.1.10.jar:lib/compiler-management-23.1.10.jar:lib/truffle-compiler-23.1.10.jar:lib/truffle-api-23.1.10.jar:lib/truffle-runtime-23.1.10.jar:lib/polyglot-23.1.10.jar:lib/collections-23.1.10.jar:lib/word-23.1.10.jar:lib/nativeimage-23.1.10.jar:lib/jniutils-23.1.10.jar -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI --add-exports=java.base/jdk.internal.misc=jdk.internal.vm.compiler" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH" value="17" />
<module name="TerrarumBuild" />

View File

@@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Terrarum" type="JarApplication">
<option name="JAR_PATH" value="$PROJECT_DIR$/out/TerrarumBuild.jar" />
<option name="VM_PARAMETERS" value="-ea -Dswing.aatext=true -Dawt.useSystemAAFontSettings=lcd" />
<option name="VM_PARAMETERS" value="-ea --upgrade-module-path=lib/compiler-23.1.10.jar:lib/compiler-management-23.1.10.jar:lib/truffle-compiler-23.1.10.jar:lib/truffle-api-23.1.10.jar:lib/truffle-runtime-23.1.10.jar:lib/polyglot-23.1.10.jar:lib/collections-23.1.10.jar:lib/word-23.1.10.jar:lib/nativeimage-23.1.10.jar:lib/jniutils-23.1.10.jar -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI --add-exports=java.base/jdk.internal.misc=jdk.internal.vm.compiler -Dswing.aatext=true -Dawt.useSystemAAFontSettings=lcd" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH" value="17" />
<module name="TerrarumBuild" />

View File

@@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Terrarum (no DEV MODE)" type="JarApplication">
<option name="JAR_PATH" value="$PROJECT_DIR$/out/TerrarumBuild.jar" />
<option name="VM_PARAMETERS" value="-Dswing.aatext=true -Dawt.useSystemAAFontSettings=lcd" />
<option name="VM_PARAMETERS" value="--upgrade-module-path=lib/compiler-23.1.10.jar:lib/compiler-management-23.1.10.jar:lib/truffle-compiler-23.1.10.jar:lib/truffle-api-23.1.10.jar:lib/truffle-runtime-23.1.10.jar:lib/polyglot-23.1.10.jar:lib/collections-23.1.10.jar:lib/word-23.1.10.jar:lib/nativeimage-23.1.10.jar:lib/jniutils-23.1.10.jar -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI --add-exports=java.base/jdk.internal.misc=jdk.internal.vm.compiler -Dswing.aatext=true -Dawt.useSystemAAFontSettings=lcd" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH" value="17" />
<module name="TerrarumBuild" />

View File

@@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Terrarum (no prebuild, release-mode assets)" type="JarApplication">
<option name="JAR_PATH" value="$PROJECT_DIR$/out/TerrarumBuild.jar" />
<option name="VM_PARAMETERS" value="-ea -Dswing.aatext=true -Dawt.useSystemAAFontSettings=lcd" />
<option name="VM_PARAMETERS" value="-ea --upgrade-module-path=lib/compiler-23.1.10.jar:lib/compiler-management-23.1.10.jar:lib/truffle-compiler-23.1.10.jar:lib/truffle-api-23.1.10.jar:lib/truffle-runtime-23.1.10.jar:lib/polyglot-23.1.10.jar:lib/collections-23.1.10.jar:lib/word-23.1.10.jar:lib/nativeimage-23.1.10.jar:lib/jniutils-23.1.10.jar -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI --add-exports=java.base/jdk.internal.misc=jdk.internal.vm.compiler -Dswing.aatext=true -Dawt.useSystemAAFontSettings=lcd" />
<option name="PROGRAM_PARAMETERS" value="--assets buildapp/out/assets.tevd" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH" value="17" />

View File

@@ -172,5 +172,5 @@ Both save/restore `camera.position` and call `setToOrtho` with `App.scr.wf/hf` o
- **`lateinit var` guards**: Use `::prop.isInitialized` checks in `resize()` and `dispose()` for properties set during async loading steps.
- **`ConsistentUpdateRate`**: Accumulates delta time; may call `updateFunction` multiple times before `renderFunction`. Call `.reset()` before transitioning to active rendering to avoid catch-up storms.
- **Textures**: Use TGA format. Images with semitransparency must be TGA; opaque images may be PNG.
- **Coordinate system**: Y-down (camera `setToOrtho(true, ...)`). `setCameraPosition(0, 0)` places origin at screen top-left.
- **Coordinate system**: Y-down (camera `setToOrtho(true, ...)`). `setCameraPosition(0, 0)` places origin at screen top-left, which is not LibGDX nor OpenGL works natively, hence the existence of `FlippingSpriteBatch`. If the user reports renders are flipped vertically, try draw()/drawFlipped() accordingly.
- **ROUNDWORLD**: World wraps horizontally. `WorldCamera.x` uses `fmod worldWidth`. Lightmap and tile drawing account for wrapping.

View File

@@ -1,4 +1,4 @@
Copyright (C) 2013-2024 Minjae Song ("CuriousTorvald")
Copyright (C) 2013-2026 Minjae Song ("CuriousTorvald")
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -9,7 +9,7 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="ModuleComputersLib" level="project" />
<orderEntry type="module" module-name="TerrarumBuild" scope="PROVIDED" />
<orderEntry type="library" scope="PROVIDED" name="graalvm-js 22.3.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="graalvm-js 23.1.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="TerrarumSansBitmap" level="project" />
<orderEntry type="library" scope="PROVIDED" name="badlogicgames.gdx" level="project" />
<orderEntry type="library" scope="PROVIDED" name="badlogicgames.gdx.backend.lwjgl3" level="project" />

View File

@@ -43,7 +43,7 @@ Requires 64 bit processor and operation system.
Kotlin runtimes must be downloaded using the IntelliJ IDEA. All other libraries are included in the repository.
The project includes modified version of the GraalVM-JS, in which the only difference is the `regex-22.3.1-edit.jar` is a modification of `regex-22.3.1.jar` where the only difference is its `MANIFEST.MD`
The project uses GraalVM 23.1.10 for JavaScript execution (with the Graal JIT compiler enabled via `--upgrade-module-path`).
## Copyright ##

View File

@@ -17,7 +17,7 @@
<orderEntry type="library" name="gdx-controllers-core-2.2.1" level="project" />
<orderEntry type="library" name="gdx-controllers-desktop-2.2.1" level="project" />
<orderEntry type="library" name="jxinput-1.0.0" level="project" />
<orderEntry type="library" name="graalvm-js 22.3.1" level="project" />
<orderEntry type="library" name="graalvm-js 23.1.10" level="project" />
<orderEntry type="library" name="badlogicgames.gdx" level="project" />
<orderEntry type="library" name="badlogicgames.gdx.backend.lwjgl3" level="project" />
<orderEntry type="library" name="io.github.classgraph" level="project" />

View File

@@ -33,6 +33,9 @@ mv $DESTDIR/out/$RUNTIME/bin/java $DESTDIR/out/$RUNTIME/bin/java
cp "out/assets.tevd" $DESTDIR/
cp "../out/$JARNAME" $DESTDIR/out/
# Copy over Graal module-path JARs for JIT compiler
cp "../lib/compiler-23.1.10.jar" "../lib/compiler-management-23.1.10.jar" "../lib/truffle-compiler-23.1.10.jar" "../lib/truffle-api-23.1.10.jar" "../lib/truffle-runtime-23.1.10.jar" "../lib/polyglot-23.1.10.jar" "../lib/collections-23.1.10.jar" "../lib/word-23.1.10.jar" "../lib/nativeimage-23.1.10.jar" "../lib/jniutils-23.1.10.jar" $DESTDIR/
# Pack everything to AppImage
ARCH=aarch64 "./$APPIMAGETOOL" $DESTDIR "out/$DESTDIR.AppImage" || { echo 'Building AppImage failed' >&2; exit 1; }
chmod +x "out/$DESTDIR.AppImage"

View File

@@ -33,6 +33,9 @@ mv $DESTDIR/out/$RUNTIME/bin/java $DESTDIR/out/$RUNTIME/bin/java
cp "out/assets.tevd" $DESTDIR/
cp "../out/$JARNAME" $DESTDIR/out/
# Copy over Graal module-path JARs for JIT compiler
cp "../lib/compiler-23.1.10.jar" "../lib/compiler-management-23.1.10.jar" "../lib/truffle-compiler-23.1.10.jar" "../lib/truffle-api-23.1.10.jar" "../lib/truffle-runtime-23.1.10.jar" "../lib/polyglot-23.1.10.jar" "../lib/collections-23.1.10.jar" "../lib/word-23.1.10.jar" "../lib/nativeimage-23.1.10.jar" "../lib/jniutils-23.1.10.jar" $DESTDIR/
# Pack everything to AppImage
"./$APPIMAGETOOL" $DESTDIR "out/$DESTDIR.AppImage" || { echo 'Building AppImage failed' >&2; exit 1; }
chmod +x "out/$DESTDIR.AppImage"

View File

@@ -36,6 +36,9 @@ mv $DESTDIR/Contents/MacOS/out/$RUNTIME/bin/java $DESTDIR/Contents/MacOS/out/$RU
cp "out/assets.tevd" $DESTDIR/Contents/MacOS/
cp "../out/$JARNAME" $DESTDIR/Contents/MacOS/out/
# Copy over Graal module-path JARs for JIT compiler
cp "../lib/compiler-23.1.10.jar" "../lib/compiler-management-23.1.10.jar" "../lib/truffle-compiler-23.1.10.jar" "../lib/truffle-api-23.1.10.jar" "../lib/truffle-runtime-23.1.10.jar" "../lib/polyglot-23.1.10.jar" "../lib/collections-23.1.10.jar" "../lib/word-23.1.10.jar" "../lib/nativeimage-23.1.10.jar" "../lib/jniutils-23.1.10.jar" $DESTDIR/Contents/MacOS/
# zip everything
cd "out"
rm $APPDIR.zip

View File

@@ -36,6 +36,9 @@ mv $DESTDIR/Contents/MacOS/out/$RUNTIME/bin/java $DESTDIR/Contents/MacOS/out/$RU
cp "out/assets.tevd" $DESTDIR/Contents/MacOS/
cp "../out/$JARNAME" $DESTDIR/Contents/MacOS/out/
# Copy over Graal module-path JARs for JIT compiler
cp "../lib/compiler-23.1.10.jar" "../lib/compiler-management-23.1.10.jar" "../lib/truffle-compiler-23.1.10.jar" "../lib/truffle-api-23.1.10.jar" "../lib/truffle-runtime-23.1.10.jar" "../lib/polyglot-23.1.10.jar" "../lib/collections-23.1.10.jar" "../lib/word-23.1.10.jar" "../lib/nativeimage-23.1.10.jar" "../lib/jniutils-23.1.10.jar" $DESTDIR/Contents/MacOS/
# zip everything
cd "out"
rm $APPDIR.zip

View File

@@ -38,6 +38,9 @@ mv $DESTDIR/out/$RUNTIME/bin/java.exe $DESTDIR/out/$RUNTIME/bin/java.exe
cp "out/assets.tevd" $DESTDIR/
cp "../out/$JARNAME" $DESTDIR/out/
# Copy over Graal module-path JARs for JIT compiler
cp "../lib/compiler-23.1.10.jar" "../lib/compiler-management-23.1.10.jar" "../lib/truffle-compiler-23.1.10.jar" "../lib/truffle-api-23.1.10.jar" "../lib/truffle-runtime-23.1.10.jar" "../lib/polyglot-23.1.10.jar" "../lib/collections-23.1.10.jar" "../lib/word-23.1.10.jar" "../lib/nativeimage-23.1.10.jar" "../lib/jniutils-23.1.10.jar" $DESTDIR/
# zip everything
rm "out/$DESTDIR.zip"
zip -r -9 -l "out/$DESTDIR.zip" $DESTDIR

View File

@@ -1,3 +1,4 @@
#!/bin/bash
cd "${0%/*}"
./out/runtime-linux-arm/bin/java -Dswing.aatext=true -Dawt.useSystemAAFontSettings=lcd -jar ./out/TerrarumBuild.jar
GRAAL_MODULE_PATH=compiler-23.1.10.jar:compiler-management-23.1.10.jar:truffle-compiler-23.1.10.jar:truffle-api-23.1.10.jar:truffle-runtime-23.1.10.jar:polyglot-23.1.10.jar:collections-23.1.10.jar:word-23.1.10.jar:nativeimage-23.1.10.jar:jniutils-23.1.10.jar
./out/runtime-linux-arm/bin/java --upgrade-module-path=$GRAAL_MODULE_PATH -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseZGC -XX:+ZGenerational -XX:+UseDynamicNumberOfGCThreads --add-exports=java.base/jdk.internal.misc=jdk.internal.vm.compiler -Dswing.aatext=true -Dawt.useSystemAAFontSettings=lcd -jar ./out/TerrarumBuild.jar

View File

@@ -1,3 +1,4 @@
#!/bin/bash
cd "${0%/*}"
./out/runtime-linux-x86/bin/java -Dswing.aatext=true -Dawt.useSystemAAFontSettings=lcd -jar ./out/TerrarumBuild.jar
GRAAL_MODULE_PATH=compiler-23.1.10.jar:compiler-management-23.1.10.jar:truffle-compiler-23.1.10.jar:truffle-api-23.1.10.jar:truffle-runtime-23.1.10.jar:polyglot-23.1.10.jar:collections-23.1.10.jar:word-23.1.10.jar:nativeimage-23.1.10.jar:jniutils-23.1.10.jar
./out/runtime-linux-x86/bin/java --upgrade-module-path=$GRAAL_MODULE_PATH -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseZGC -XX:+ZGenerational -XX:+UseDynamicNumberOfGCThreads --add-exports=java.base/jdk.internal.misc=jdk.internal.vm.compiler -Dswing.aatext=true -Dawt.useSystemAAFontSettings=lcd -jar ./out/TerrarumBuild.jar

View File

@@ -1,3 +1,4 @@
#!/bin/bash
cd "${0%/*}"
./out/runtime-osx-arm/bin/java -jar ./out/TerrarumBuild.jar
GRAAL_MODULE_PATH=compiler-23.1.10.jar:compiler-management-23.1.10.jar:truffle-compiler-23.1.10.jar:truffle-api-23.1.10.jar:truffle-runtime-23.1.10.jar:polyglot-23.1.10.jar:collections-23.1.10.jar:word-23.1.10.jar:nativeimage-23.1.10.jar:jniutils-23.1.10.jar
./out/runtime-osx-arm/bin/java --upgrade-module-path=$GRAAL_MODULE_PATH -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseZGC -XX:+ZGenerational -XX:+UseDynamicNumberOfGCThreads --add-exports=java.base/jdk.internal.misc=jdk.internal.vm.compiler -jar ./out/TerrarumBuild.jar

View File

@@ -1,3 +1,4 @@
#!/bin/bash
cd "${0%/*}"
./out/runtime-osx-x86/bin/java -jar ./out/TerrarumBuild.jar
GRAAL_MODULE_PATH=compiler-23.1.10.jar:compiler-management-23.1.10.jar:truffle-compiler-23.1.10.jar:truffle-api-23.1.10.jar:truffle-runtime-23.1.10.jar:polyglot-23.1.10.jar:collections-23.1.10.jar:word-23.1.10.jar:nativeimage-23.1.10.jar:jniutils-23.1.10.jar
./out/runtime-osx-x86/bin/java --upgrade-module-path=$GRAAL_MODULE_PATH -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseZGC -XX:+ZGenerational -XX:+UseDynamicNumberOfGCThreads --add-exports=java.base/jdk.internal.misc=jdk.internal.vm.compiler -jar ./out/TerrarumBuild.jar

View File

@@ -7,7 +7,11 @@ int main() {
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
char cmd[] = "\".\\out\\runtime-windows-x86\\bin\\java.exe\" -jar \".\\out\\TerrarumBuild.jar\"";
char cmd[] = "\".\\out\\runtime-windows-x86\\bin\\java.exe\" "
"--upgrade-module-path=compiler-23.1.10.jar;compiler-management-23.1.10.jar;truffle-compiler-23.1.10.jar;truffle-api-23.1.10.jar;truffle-runtime-23.1.10.jar;polyglot-23.1.10.jar;collections-23.1.10.jar;word-23.1.10.jar;nativeimage-23.1.10.jar;jniutils-23.1.10.jar "
"-XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseZGC -XX:+ZGenerational -XX:+UseDynamicNumberOfGCThreads "
"--add-exports=java.base/jdk.internal.misc=jdk.internal.vm.compiler "
"-jar \".\\out\\TerrarumBuild.jar\"";
CreateProcessA(
NULL,

Binary file not shown.

Binary file not shown.

BIN
lib/collections-23.1.10.jar LFS Normal file

Binary file not shown.

BIN
lib/compiler-23.1.10-javadoc.jar LFS Normal file

Binary file not shown.

BIN
lib/compiler-23.1.10-sources.jar LFS Normal file

Binary file not shown.

BIN
lib/compiler-23.1.10.jar LFS Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/icu4j-23.1.10-javadoc.jar LFS Normal file

Binary file not shown.

BIN
lib/icu4j-23.1.10-sources.jar LFS Normal file

Binary file not shown.

BIN
lib/icu4j-23.1.10.jar LFS Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/jniutils-23.1.10-javadoc.jar LFS Normal file

Binary file not shown.

BIN
lib/jniutils-23.1.10-sources.jar LFS Normal file

Binary file not shown.

BIN
lib/jniutils-23.1.10.jar LFS Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/js-language-23.1.10.jar LFS Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/js-scriptengine-23.1.10.jar LFS Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/nativeimage-23.1.10.jar LFS Normal file

Binary file not shown.

BIN
lib/polyglot-23.1.10-javadoc.jar LFS Normal file

Binary file not shown.

BIN
lib/polyglot-23.1.10-sources.jar LFS Normal file

Binary file not shown.

BIN
lib/polyglot-23.1.10.jar LFS Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/regex-23.1.10-javadoc.jar LFS Normal file

Binary file not shown.

BIN
lib/regex-23.1.10-sources.jar LFS Normal file

Binary file not shown.

BIN
lib/regex-23.1.10.jar LFS Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/truffle-api-23.1.10.jar LFS Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/truffle-compiler-23.1.10.jar LFS Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/truffle-runtime-23.1.10.jar LFS Normal file

Binary file not shown.

BIN
lib/word-23.1.10-javadoc.jar LFS Normal file

Binary file not shown.

BIN
lib/word-23.1.10-sources.jar LFS Normal file

Binary file not shown.

BIN
lib/word-23.1.10.jar LFS Normal file

Binary file not shown.

View File

@@ -265,10 +265,10 @@ public class App implements ApplicationListener {
public static Hq2x hq2x;
public static Mesh fullscreenQuad;
private static OrthographicCamera camera;
private static FlippingSpriteBatch logoBatch;
public static OrthographicCamera camera;
public static FlippingSpriteBatch logoBatch;
public static TextureRegion splashScreenLogo;
private static TextureRegion splashBackdrop;
public static TextureRegion splashBackdrop;
public static AudioDevice audioDevice;
public static FlippingSpriteBatch batch;
@@ -280,6 +280,11 @@ public class App implements ApplicationListener {
private static TerrarumGamescreen currentScreen;
private static LoadScreenBase currentSetLoadScreen;
/** When set, App.render() will capture postProcessorOutFBO and then transition to this screen after the current frame finishes. */
public static TerrarumGamescreen pendingScreenWithCapture = null;
/** Populated by the deferred-capture path; consumed by TitleScreen.show(). */
public static Pixmap captureLastFrame = null;
private void initViewPort(int width, int height) {
// Set Y to point downwards
camera.setToOrtho(true, width, height); // some elements are pre-flipped, while some are not. The statement itself is absolutely necessary to make edge of the screen as the origin
@@ -336,7 +341,7 @@ public class App implements ApplicationListener {
"xinput", "xbox", "game", "joy", "pad"
};
public static InputStrober inputStrober;
public static InputStrober inputStrober; // set by IME.kt loading thread
public static long bogoflops = 0L;
@@ -545,7 +550,7 @@ public class App implements ApplicationListener {
}
}
private static Color splashTextCol = new Color(0x282828FF);
public static Color splashTextCol = new Color(0x282828FF);
@Override
public void create() {
@@ -747,6 +752,7 @@ public class App implements ApplicationListener {
// hand over the scene control to this single class; Terrarum must call
// 'AppLoader.getINSTANCE().screen.render(delta)', this is not redundant at all!
SplashScreen.loadingComplete = true;
IngameInstance title = ModMgr.INSTANCE.getTitleScreen(batch);
if (title != null) {
@@ -767,6 +773,17 @@ public class App implements ApplicationListener {
currentScreen.render(UPDATE_RATE);
postProcessorOutFBO = TerrarumPostProcessor.INSTANCE.draw(Gdx.graphics.getDeltaTime(), camera.combined, renderFBO);
// Deferred transition: capture the just-rendered frame then switch screens.
// This fires AFTER the current screen has fully rendered so the capture is of the real last ingame frame.
if (pendingScreenWithCapture != null) {
TerrarumGamescreen next = pendingScreenWithCapture;
pendingScreenWithCapture = null;
FrameBufferManager.begin(postProcessorOutFBO);
captureLastFrame = Pixmap.createFromFrameBuffer(0, 0, postProcessorOutFBO.getWidth(), postProcessorOutFBO.getHeight());
FrameBufferManager.end();
setScreen(next);
}
}
@@ -866,104 +883,7 @@ public class App implements ApplicationListener {
}
public static void drawSplash() {
setCameraPosition(0f, 0f);
logoBatch.setColor(Color.WHITE);
logoBatch.setBlendFunctionSeparate(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA, GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA);
int drawWidth = Toolkit.INSTANCE.getDrawWidth();
int safetyTextLen = fontGame.getWidth(Lang.INSTANCE.get("APP_WARNING_HEALTH_AND_SAFETY", true));
int logoPosX0 = (drawWidth - splashScreenLogo.getRegionWidth() - safetyTextLen) >>> 1;
int logoPosY = Math.round(scr.getHeight() / 15f);
int textY = logoPosY + splashScreenLogo.getRegionHeight() - 16;
// draw custom backdrop (if exists)
if (splashBackdrop != null) {
logoBatch.setShader(null);
logoBatch.begin();
var size = ((float) Math.max(scr.getWidth(), scr.getHeight()));
var x = 0f;
var y = 0f;
if (scr.getWidth() > scr.getHeight()) {
y = (scr.getHeight() - size) / 2f;
}
else {
x = (scr.getWidth() - size) / 2f;
}
logoBatch.draw(splashBackdrop, x, y, size, size);
logoBatch.end();
}
int logoPosX = (int)(logoPosX0 + Math.round(100 * Math.sin(GLOBAL_RENDER_TIMER / 50.0)));
// draw logo reflection
logoBatch.setShader(shaderReflect);
logoBatch.setColor(Color.WHITE);
logoBatch.begin();
if (getConfigBoolean("showhealthmessageonstartup")) {
logoBatch.draw(splashScreenLogo, logoPosX, logoPosY + splashScreenLogo.getRegionHeight());
}
else {
logoBatch.draw(splashScreenLogo, (drawWidth - splashScreenLogo.getRegionWidth()) / 2f,
(scr.getHeight() - splashScreenLogo.getRegionHeight() * 2) / 2f + splashScreenLogo.getRegionHeight()
);
}
logoBatch.end();
logoBatch.setShader(null);
logoBatch.begin();
if (getConfigBoolean("showhealthmessageonstartup")) {
logoBatch.draw(splashScreenLogo, logoPosX, logoPosY);
}
else {
logoBatch.draw(splashScreenLogo, (drawWidth - splashScreenLogo.getRegionWidth()) / 2f,
(scr.getHeight() - splashScreenLogo.getRegionHeight() * 2) / 2f
);
}
logoBatch.end();
// draw health messages
if (getConfigBoolean("showhealthmessageonstartup")) {
logoBatch.setShader(null);
logoBatch.begin();
logoBatch.setColor(splashTextCol);
fontGame.draw(logoBatch, Lang.INSTANCE.get("APP_WARNING_HEALTH_AND_SAFETY", true),
logoPosX + splashScreenLogo.getRegionWidth(),
textY
);
// some chinese stuff
if (GAME_LOCALE.contentEquals("zhCN")) {
for (int i = 1; i <= 4; i++) {
String s = Lang.INSTANCE.get("APP_CHINESE_HEALTHY_GAME_MSG_" + i, true);
fontGame.draw(logoBatch, s,
(drawWidth - fontGame.getWidth(s)) >>> 1,
Math.round(scr.getHeight() * 12f / 15f + fontGame.getLineHeight() * (i - 1))
);
}
}
Texture tex1 = CommonResourcePool.INSTANCE.getAsTexture("title_health1");
Texture tex2 = CommonResourcePool.INSTANCE.getAsTexture("title_health2");
int virtualHeight = scr.getHeight() - logoPosY - splashScreenLogo.getRegionHeight() / 4;
int virtualHeightOffset = scr.getHeight() - virtualHeight;
logoBatch.drawFlipped(tex1, (drawWidth - tex1.getWidth()) >>> 1, virtualHeightOffset + (virtualHeight >>> 1) - 16, tex1.getWidth(), -tex1.getHeight());
logoBatch.drawFlipped(tex2, (drawWidth - tex2.getWidth()) >>> 1, virtualHeightOffset + (virtualHeight >>> 1) + 16 + tex2.getHeight(), tex2.getWidth(), -tex2.getHeight());
}
logoBatch.end();
batch.setBlendFunctionSeparate(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA, GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA);
SplashScreen.render(logoBatch, camera);
}
/**
@@ -1275,13 +1195,12 @@ public class App implements ApplicationListener {
false,
64, false, 203f/255f, false
);
Lang.invoke();
printdbg(this, "Font done at "+((System.nanoTime() - t1) / 1000000000.0)+" seconds");
fontSmallNumbers = TinyAlphNum.INSTANCE;
fontBigNumbers = BigAlphNum.INSTANCE;
printdbg(this, "Font done at "+((System.nanoTime() - t1) / 1000000000.0)+" seconds");
try {
audioDevice = Gdx.audio.newAudioDevice(48000, false);
}
@@ -1290,14 +1209,19 @@ public class App implements ApplicationListener {
System.err.println("[AppLoader] failed to create audio device: Audio device occupied by Exclusive Mode Device? (e.g. ASIO4all)");
}
IME.invoke();
inputStrober = InputStrober.INSTANCE;
printdbg(this, "IME done (loading thread) at "+((System.nanoTime() - t1) / 1000000000.0)+" seconds");
printdbg(this, "AudioDevice done at "+((System.nanoTime() - t1) / 1000000000.0)+" seconds");
IME.invoke(); // calls `App.inputStrober = InputStrober` on our behalf
printdbg(this, "IME done at "+((System.nanoTime() - t1) / 1000000000.0)+" seconds");
// Set GL thread reference for CommonResourcePool dispatch
CommonResourcePool.INSTANCE.setGLThread(Thread.currentThread());
// Launch loading thread for ModMgr + slow resource loading
postInitLoadingThread = new Thread(() -> {
Lang.invoke();
printdbg(this, "Lang done (loading thread) at "+((System.nanoTime() - t1) / 1000000000.0)+" seconds");
ModMgr.INSTANCE.invoke(); // triggers module init block + EntryPoint.invoke() calls
printdbg(this, "ModMgr done (loading thread) at "+((System.nanoTime() - t1) / 1000000000.0)+" seconds");
@@ -1448,7 +1372,7 @@ public class App implements ApplicationListener {
}
private static void setCameraPosition(float newX, float newY) {
public static void setCameraPosition(float newX, float newY) {
camera.position.set((-newX + scr.getWidth() / 2), (-newY + scr.getHeight() / 2), 0f); // deliberate integer division
camera.update();
logoBatch.setProjectionMatrix(camera.combined);

View File

@@ -53,6 +53,7 @@ public class Principii {
}
}
private static final String GRAAL_MODULE_PATH = "compiler-23.1.10.jar:compiler-management-23.1.10.jar:truffle-compiler-23.1.10.jar:truffle-api-23.1.10.jar:truffle-runtime-23.1.10.jar:polyglot-23.1.10.jar:collections-23.1.10.jar:word-23.1.10.jar:nativeimage-23.1.10.jar:jniutils-23.1.10.jar";
public static void main(String[] args) {
@@ -130,6 +131,13 @@ public class Principii {
List<String> userDefinedExtraCmds = Arrays.stream(userDefinedExtraCmd0.split(" +")).filter((it) -> !it.isBlank()).toList();
ArrayList<String> cmd0 = new ArrayList<>();
cmd0.add(runtime);
cmd0.add("--upgrade-module-path="+GRAAL_MODULE_PATH);
cmd0.add("-XX:+UnlockExperimentalVMOptions");
cmd0.add("-XX:+EnableJVMCI");
cmd0.add("-XX:+UseZGC");
cmd0.add("-XX:+ZGenerational");
cmd0.add("-XX:+UseDynamicNumberOfGCThreads");
cmd0.add("--add-exports=java.base/jdk.internal.misc=jdk.internal.vm.compiler");
cmd0.addAll(extracmds);
cmd0.addAll(userDefinedExtraCmds);
// cmd0.add("-Dhttps.protocols=SSLv3,TLSv1.2,TLSv1.1,TLSv1");

View File

@@ -0,0 +1,154 @@
package net.torvald.terrarum
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.GL20
import com.badlogic.gdx.graphics.OrthographicCamera
import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.ui.UIItemHorzSlider
import kotlin.math.max
/**
* Draws the cold-boot splash screen: backdrop, logo, loading bar, subtitle, and health messages.
* Consolidated from App.drawSplash() so all splash rendering lives here.
*
* Progress is time-based: p = t / (t + HALF_TIME_MS), snapping to 1.0 when
* [loadingComplete] is set to true by App right before transitioning to the title screen.
*
* Created by minjaesong on 2026-04-06.
*/
object SplashScreen {
/** Set to true by App when loading completes, to snap the bar to 100%. */
@JvmField @Volatile var loadingComplete = false
private const val HALF_TIME_MS = 1500L // progress = t / (t + HALF_TIME_MS)
private val stubParent = object : UICanvas() {
override var width = 0
override var height = 0
override fun updateImpl(delta: Float) {}
override fun renderImpl(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {}
override fun dispose() {}
}
private var loadingBar: UIItemHorzSlider? = null
private var lastBarWidth = 0
private var startTime = 0L
private val subtitleCol = Color(0.75f, 0.75f, 0.75f, 1f)
@JvmStatic fun render(batch: SpriteBatch, camera: OrthographicCamera) {
App.setCameraPosition(0f, 0f)
val batch = App.logoBatch
val scr = App.scr
val drawWidth = Toolkit.drawWidth
val showHealth = App.getConfigBoolean("showhealthmessageonstartup")
batch.color = Color.WHITE
batch.setBlendFunctionSeparate(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA, GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA)
val safetyTextLen = if (showHealth) App.fontGame.getWidth(Lang["APP_WARNING_HEALTH_AND_SAFETY", true]) else 0
val logoPosX0 = (drawWidth - App.splashScreenLogo.regionWidth - safetyTextLen) ushr 1
val logoPosY = Math.round(scr.height / 15f)
val textY = logoPosY + App.splashScreenLogo.regionHeight - 16
// backdrop
App.splashBackdrop?.let { backdrop ->
batch.setShader(null)
batch.inUse {
val size = max(scr.width, scr.height).toFloat()
val x = if (scr.width > scr.height) 0f else (scr.width - size) / 2f
val y = if (scr.width > scr.height) (scr.height - size) / 2f else 0f
batch.draw(backdrop, x, y, size, size)
}
}
val logoPosX = logoPosX0
// logo reflection
batch.setShader(App.shaderReflect)
batch.color = Color.WHITE
batch.inUse {
if (showHealth) {
batch.draw(App.splashScreenLogo, logoPosX.toFloat(), (logoPosY + App.splashScreenLogo.regionHeight).toFloat())
} else {
batch.draw(App.splashScreenLogo,
(drawWidth - App.splashScreenLogo.regionWidth) / 2f,
(scr.height - App.splashScreenLogo.regionHeight * 2) / 2f + App.splashScreenLogo.regionHeight)
}
}
// logo
batch.setShader(null)
batch.inUse {
if (showHealth) {
batch.draw(App.splashScreenLogo, logoPosX.toFloat(), logoPosY.toFloat())
} else {
batch.draw(App.splashScreenLogo,
(drawWidth - App.splashScreenLogo.regionWidth) / 2f,
(scr.height - App.splashScreenLogo.regionHeight * 2) / 2f)
}
}
// loading bar+subtitle
if (startTime == 0L) startTime = System.currentTimeMillis()
val elapsed = System.currentTimeMillis() - startTime
val progress = if (loadingComplete) 1f
else elapsed.toFloat() / (elapsed + HALF_TIME_MS).toFloat()
val barWidth = (Toolkit.drawWidth * 0.4f).toInt().coerceAtLeast(200)
val barX = (Toolkit.drawWidth - barWidth) / 2
val barY = App.scr.height - App.scr.tvSafeGraphicsHeight - 24
if (loadingBar == null || lastBarWidth != barWidth) {
lastBarWidth = barWidth
loadingBar = UIItemHorzSlider(stubParent, barX, barY, 0.0, 0.0, 1.0, barWidth).also {
it.suppressHaptic = true
it.isEnabled = false
}
}
val bar = loadingBar ?: return
bar.posX = barX
bar.posY = barY
bar.handleWidth = (progress * barWidth).toInt().coerceIn(12, barWidth)
val subtitle = "Reticulating Splines..."
val subtitleW = App.fontGame.getWidth(subtitle)
val subtitleX = (Toolkit.drawWidth - subtitleW) / 2f
val subtitleY = (barY - 32).toFloat()
batch.inUse {
batch.color = subtitleCol
App.fontGame.draw(batch, subtitle, subtitleX, subtitleY)
batch.color = Color.WHITE
bar.render(0f, batch, camera)
}
// health messages
if (showHealth) {
batch.setShader(null)
batch.inUse {
batch.color = App.splashTextCol
App.fontGame.draw(batch, Lang["APP_WARNING_HEALTH_AND_SAFETY", true],
(logoPosX + App.splashScreenLogo.regionWidth).toFloat(), textY.toFloat())
val tex1 = CommonResourcePool.getAsTexture("title_health1")
val tex2 = CommonResourcePool.getAsTexture("title_health2")
val virtualHeight = scr.height - logoPosY - App.splashScreenLogo.regionHeight / 4
val virtualHeightOffset = scr.height - virtualHeight
batch.drawFlipped(tex1, ((drawWidth - tex1.width) ushr 1).toFloat(), (virtualHeightOffset + (virtualHeight ushr 1) - 16).toFloat(), tex1.width.toFloat(), (-tex1.height).toFloat())
batch.drawFlipped(tex2, ((drawWidth - tex2.width) ushr 1).toFloat(), (virtualHeightOffset + (virtualHeight ushr 1) + 16 + tex2.height).toFloat(), tex2.width.toFloat(), (-tex2.height).toFloat())
}
}
App.batch.setBlendFunctionSeparate(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA, GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA)
}
}

View File

@@ -1,6 +1,5 @@
package net.torvald.terrarum.gamecontroller
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.files.FileHandle
import com.badlogic.gdx.graphics.Pixmap
import com.badlogic.gdx.graphics.g2d.TextureRegion
@@ -111,6 +110,8 @@ object IME {
printdbg(this, "Registering High layer ${it.nameWithoutExtension.lowercase()}")
registerHighLayer(it.nameWithoutExtension.lowercase(), parseImeFile(it))
}
App.inputStrober = InputStrober
}, "Terrarum-IMELoader")
layoutLoadingThread.isDaemon = true
layoutLoadingThread.start()

View File

@@ -727,7 +727,7 @@ class MovableWorldCamera(val parent: BuildingMaker) : ActorHumanoid(0, physProp
class YamlCommandExit : YamlInvokable {
override fun invoke(args: Array<Any>) {
App.setScreen(TitleScreen(App.batch))
App.pendingScreenWithCapture = TitleScreen(App.batch)
}
}

View File

@@ -8,8 +8,10 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion
import com.badlogic.gdx.graphics.glutils.Float16FrameBuffer
import com.badlogic.gdx.graphics.glutils.FrameBuffer
import com.badlogic.gdx.graphics.glutils.ShaderProgram
import com.badlogic.gdx.utils.BufferUtils
import com.badlogic.gdx.utils.Disposable
import com.jme3.math.FastMath
import java.nio.ByteBuffer
import net.torvald.random.HQRNG
import net.torvald.terrarum.*
import net.torvald.terrarum.App.*
@@ -87,12 +89,21 @@ object IngameRenderer : Disposable {
private lateinit var fboRGBwall: Float16FrameBuffer // for masking away the shadows
private lateinit var fboUI: Float16FrameBuffer // UI composite target for scene-aware dimming
private lateinit var fboSceneAvg: Float16FrameBuffer // tiny target for brightness readback
private lateinit var rgbTex: TextureRegion
private lateinit var aTex: TextureRegion
private lateinit var mixedOutTex: TextureRegion
private lateinit var uiTex: TextureRegion
private lateinit var lightTex: TextureRegion
private lateinit var blurTex: TextureRegion
// Contextual UI dimming: dim slightly when the world scene is dark.
private val sceneAvgBuf: ByteBuffer = BufferUtils.newByteBuffer(SCENE_AVG_SIZE * SCENE_AVG_SIZE * 4)
@Volatile private var smoothedSceneLuma = 1f
private var uiDimFactor = 1f
private lateinit var fboBlurHalf: Float16FrameBuffer
// private lateinit var fboBlurQuarter: Float16FrameBuffer
@@ -136,6 +147,14 @@ object IngameRenderer : Disposable {
/** lower value = greater lozenge artefact from linear intp */
const val lightmapDownsample = 2f // still has choppy look when the camera moves but unnoticeable when blurred
// Contextual UI dimming parameters.
private const val SCENE_AVG_SIZE = 16 // side of the small RGBA8 FBO used for brightness readback
private const val SCENE_AVG_INTERVAL = 6L // sample every N frames; smoothing fills the gaps
private const val UI_DIM_DARK_FACTOR = 0.8f // 80% brightness when the scene is dark
private const val UI_DIM_DARK_LUMA = 0.08f // luma at/below this -> fully dimmed
private const val UI_DIM_BRIGHT_LUMA = 0.22f // luma at/above this -> no dimming
private const val UI_DIM_SMOOTHING = 0.12f // per-sample EMA factor for luma
private var debugMode = 0
var renderingActorsCount = 0
@@ -444,20 +463,38 @@ object IngameRenderer : Disposable {
///////////////////////////////////////////////////////////////////////
// draw UI
setCameraPosition(0f, 0f)
// contextual UI dimming: keep uiDimFactor in sync with the rendered scene's brightness
sampleSceneBrightness()
batch.inUse {
batch.shader = null
batch.color = Color.WHITE
// draw UI into its own FBO so individual UIs can keep using batch.color freely
fboUI.inAction(camera, batch) {
gdxClearAndEnableBlend(0f, 0f, 0f, 0f)
blendNormalStraightAlpha(batch)
if (!KeyToggler.isOn(Input.Keys.F4)) {
uiContainer?.forEach {
it?.render(frameDelta, batch, camera)
batch.inUse {
batch.shader = null
batch.color = Color.WHITE
if (!KeyToggler.isOn(Input.Keys.F4)) {
uiContainer?.forEach {
it?.render(frameDelta, batch, camera)
}
}
}
}
// composite UI on top of the world with the contextual dim tint
setCameraPosition(0f, 0f)
blendNormalPremultAlpha(batch)
uiTex.texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest)
batch.inUse {
batch.shader = null
batch.color = Color(uiDimFactor, uiDimFactor, uiDimFactor, 1f)
batch.drawFlipped(uiTex, 0f, 0f, fboUI.width.toFloat(), fboUI.height.toFloat())
batch.color = Color.WHITE
}
// works but some UI elements have wrong transparency -> should be fixed with Terrarum.gdxCleanAndSetBlend -- Torvald 2019-01-12
blendNormalStraightAlpha(batch)
batch.color = Color.WHITE
@@ -466,6 +503,48 @@ object IngameRenderer : Disposable {
if (newWorldLoadedLatch) newWorldLoadedLatch = false
}
/**
* Downsamples [fboMixedOut] into [fboSceneAvg], reads it back, and updates [smoothedSceneLuma]
* and [uiDimFactor]. Sampling is throttled to every [SCENE_AVG_INTERVAL] frames; the EMA fills gaps.
*/
private fun sampleSceneBrightness() {
if (App.GLOBAL_RENDER_TIMER % SCENE_AVG_INTERVAL == 0L) {
mixedOutTex.texture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear)
fboSceneAvg.inAction(camera, batch) {
gdxClearAndEnableBlend(0f, 0f, 0f, 1f)
batch.inUse {
batch.shader = null
batch.color = Color.WHITE
batch.draw(mixedOutTex, 0f, 0f, fboSceneAvg.width.toFloat(), fboSceneAvg.height.toFloat())
}
sceneAvgBuf.rewind()
Gdx.gl.glReadPixels(0, 0, fboSceneAvg.width, fboSceneAvg.height,
GL20.GL_RGBA, GL20.GL_UNSIGNED_BYTE, sceneAvgBuf)
}
sceneAvgBuf.rewind()
var sumR = 0L
var sumG = 0L
var sumB = 0L
val count = fboSceneAvg.width * fboSceneAvg.height
for (i in 0 until count) {
sumR += (sceneAvgBuf.get().toInt() and 0xFF)
sumG += (sceneAvgBuf.get().toInt() and 0xFF)
sumB += (sceneAvgBuf.get().toInt() and 0xFF)
sceneAvgBuf.get() // alpha discarded
}
val inv = 1f / (count * 255f)
val luma = 0.2126f * (sumR * inv) + 0.7152f * (sumG * inv) + 0.0722f * (sumB * inv)
smoothedSceneLuma += (luma - smoothedSceneLuma) * UI_DIM_SMOOTHING
}
val t = ((smoothedSceneLuma - UI_DIM_DARK_LUMA) / (UI_DIM_BRIGHT_LUMA - UI_DIM_DARK_LUMA))
.coerceIn(0f, 1f)
uiDimFactor = UI_DIM_DARK_FACTOR + (1f - UI_DIM_DARK_FACTOR) * t
}
private fun prepLightmapRGBA() {
lightmapFbo.inAction(null, null) {
@@ -1305,6 +1384,9 @@ object IngameRenderer : Disposable {
fboBlurHalf.dispose()
//fboBlurQuarter.dispose()
if (::fboUI.isInitialized) fboUI.dispose()
if (::fboSceneAvg.isInitialized) fboSceneAvg.dispose()
}
// BlocksDrawer and LightmapRenderer must be resized before lightmapFbo is created,
@@ -1332,11 +1414,15 @@ object IngameRenderer : Disposable {
LightmapRenderer.lightBuffer.height * LightmapRenderer.DRAW_TILE_SIZE.toInt(),
false
)
fboUI = Float16FrameBuffer(width, height, false)
fboSceneAvg = Float16FrameBuffer(SCENE_AVG_SIZE, SCENE_AVG_SIZE, false)
rgbTex = TextureRegion(fboRGB_lightMixed.colorBufferTexture)
aTex = TextureRegion(fboA_lightMixed.colorBufferTexture)
lightTex = TextureRegion(lightmapFbo.colorBufferTexture)
blurTex = TextureRegion()
mixedOutTex = TextureRegion(fboMixedOut.colorBufferTexture)
uiTex = TextureRegion(fboUI.colorBufferTexture)
fboBlurHalf = Float16FrameBuffer(
LightmapRenderer.lightBuffer.width * LightmapRenderer.DRAW_TILE_SIZE.toInt() / 2,
@@ -1394,6 +1480,8 @@ object IngameRenderer : Disposable {
if (::fboRGBactorsMiddleShadow.isInitialized) fboRGBactorsMiddleShadow.tryDispose()
if (::fboRGBterrainShadow.isInitialized) fboRGBterrainShadow.tryDispose()
if (::fboRGBwall.isInitialized) fboRGBwall.tryDispose()
if (::fboUI.isInitialized) fboUI.tryDispose()
if (::fboSceneAvg.isInitialized) fboSceneAvg.tryDispose()
blurtex0.tryDispose()

View File

@@ -5,6 +5,7 @@ import com.badlogic.gdx.Input
import com.badlogic.gdx.InputAdapter
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.OrthographicCamera
import com.badlogic.gdx.graphics.Pixmap
import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.g2d.TextureRegion
@@ -71,6 +72,11 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
private var glLoadStep = 0
private lateinit var titleLoadingThread: Thread
private var splashCapture: Texture? = null
private var settleFrames = 0
private var transitionState = 0 // 0=loading, 1=settling, 2=fading, 3=done
private var enteringFromIngame = false
private lateinit var demoWorld: GameWorld
private lateinit var cameraNodes: FloatArray // camera Y-pos
private val cameraNodeWidth = 15
@@ -291,6 +297,15 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
override fun show() {
printdbg(this, "show() called")
// consume the pre-captured frame provided by App.render()'s deferred-capture path
val pixmap = App.captureLastFrame
App.captureLastFrame = null
if (pixmap != null) {
splashCapture = Texture(pixmap)
pixmap.dispose()
enteringFromIngame = true
}
for (k in Input.Keys.F1..Input.Keys.F12) {
KeyToggler.forceSet(k, false)
}
@@ -314,23 +329,80 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
}
private val introUncoverTime: Second = 0.3f
private var introUncoverDeltaCounter = 0f
private val introFadeTime: Second = 0.5f
private var introFadeDeltaCounter = 0f
private val settleFrameCount = 12
override fun renderImpl(updateRate: Float) {
if (!loadDone) {
App.drawSplash()
processGLLoadStep()
return
when (transitionState) {
// Loading phase: show splash or last ingame frame, advance GL load steps
0 -> {
if (enteringFromIngame) {
// hold the last ingame frame while the title screen loads in the background
drawSplashCapture(1f)
} else {
App.drawSplash()
}
processGLLoadStep()
if (loadDone) {
if (!enteringFromIngame) {
// capture the current splash screen frame for the crossfade
val pixmap = Pixmap.createFromFrameBuffer(0, 0, App.scr.width, App.scr.height)
splashCapture = Texture(pixmap)
pixmap.dispose()
}
transitionState = 1
settleFrames = 0
}
}
// Settle phase: render title screen normally but paint captured splash on top
1 -> {
renderTitleScreen()
drawSplashCapture(1f)
settleFrames++
if (settleFrames >= settleFrameCount) {
transitionState = 2
introFadeDeltaCounter = 0f
}
}
// Fade phase: crossfade from captured splash to title screen
2 -> {
renderTitleScreen()
introFadeDeltaCounter += Gdx.graphics.deltaTime
val opacity = 1f - (introFadeDeltaCounter / introFadeTime).coerceIn(0f, 1f)
drawSplashCapture(opacity)
if (introFadeDeltaCounter >= introFadeTime) {
splashCapture?.dispose()
splashCapture = null
transitionState = 3
}
}
// Normal rendering
3 -> {
renderTitleScreen()
}
}
}
private fun renderTitleScreen() {
IngameRenderer.setRenderedWorld(demoWorld)
super.renderImpl(updateRate)
// async update and render
super.renderImpl(0f)
gameUpdateGovernor.update(Gdx.graphics.deltaTime, App.UPDATE_RATE, updateScreen, renderScreen)
}
private fun drawSplashCapture(opacity: Float) {
val tex = splashCapture ?: return
setCameraPosition(0f, 0f)
blendNormalStraightAlpha(batch)
batch.inUse {
batch.shader = null
batch.color = Color(1f, 1f, 1f, opacity)
// framebuffer capture is Y-flipped; draw flipped
batch.drawFlipped(tex, 0f, 0f)
batch.color = Color.WHITE
}
}
private val updateScreen = { delta: Float ->
demoWorld.globalLight = WeatherMixer.globalLightNow
@@ -586,6 +658,7 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
override fun dispose() {
if (::uiRemoCon.isInitialized) uiRemoCon.dispose()
if (::demoWorld.isInitialized) demoWorld.dispose()
splashCapture?.dispose()
warning32bitJavaIcon.texture.dispose()
warningAppleRosettaIcon.texture.dispose()
}

View File

@@ -176,7 +176,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
when (new) {
2 -> {
areYouSureMainMenuButtons.deselect()
App.setScreen(TitleScreen(App.batch))
App.pendingScreenWithCapture = TitleScreen(App.batch)
}
3 -> {
screen = 0; areYouSureMainMenuButtons.deselect()

View File

@@ -63,7 +63,7 @@ class UIItemHorzSlider(
override fun update(delta: Float) {
super.update(delta)
mouseOnHandle = itemRelativeMouseX in handlePos.roundToInt() until handlePos.roundToInt() + handleWidth && itemRelativeMouseY in 0 until height
mouseOnHandle = if (!isEnabled) false else itemRelativeMouseX in handlePos.roundToInt() until handlePos.roundToInt() + handleWidth && itemRelativeMouseY in 0 until height
// update handle position and value
if (mouseUp && Terrarum.mouseDown || mouseLatched) {

View File

@@ -6,7 +6,7 @@ import com.badlogic.gdx.graphics.OrthographicCamera
import com.badlogic.gdx.graphics.Pixmap
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.glutils.FrameBuffer
import com.ibm.icu.text.Normalizer2
import org.graalvm.shadowed.com.ibm.icu.text.Normalizer2 // wtf?
import com.jme3.math.FastMath
import net.torvald.terrarum.*
import net.torvald.terrarum.gamecontroller.*

View File

@@ -60,7 +60,7 @@ class UIItemVertSlider(
override fun update(delta: Float) {
super.update(delta)
mouseOnHandle = itemRelativeMouseY in handlePos.roundToInt() until handlePos.roundToInt() + handleHeight && itemRelativeMouseX in 0 until width
mouseOnHandle = if (!isEnabled) false else itemRelativeMouseY in handlePos.roundToInt() until handlePos.roundToInt() + handleHeight && itemRelativeMouseX in 0 until width
// update handle position and value
if (mouseUp && Terrarum.mouseDown || mouseLatched) {