first commit
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
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 = "21"
|
||||
// This should probably be equal to targetCompatibility, above. This only affects the TeaVM module.
|
||||
java.sourceCompatibility = "21"
|
||||
|
||||
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("own.planetslivewallpaper.reflect")
|
||||
|
||||
webDefaults {
|
||||
mainClass.set("own.planetslivewallpaper.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")
|
||||
@@ -0,0 +1,20 @@
|
||||
@file:JvmName("TeaVMLauncher")
|
||||
|
||||
package own.planetslivewallpaper.teavm
|
||||
|
||||
import com.github.xpenatan.gdx.teavm.backends.web.WebApplicationConfiguration
|
||||
import com.github.xpenatan.gdx.teavm.backends.web.WebApplication
|
||||
import own.planetslivewallpaper.Main
|
||||
|
||||
/** Launches the TeaVM/HTML application. */
|
||||
fun main() {
|
||||
val config = WebApplicationConfiguration("canvas").apply {
|
||||
//// If width and height are each greater than 0, then the app will use a fixed size.
|
||||
//width = 640
|
||||
//height = 480
|
||||
//// If width and height are both 0, then the app will use all available space.
|
||||
width = 0
|
||||
height = 0
|
||||
}
|
||||
WebApplication(Main(), config)
|
||||
}
|
||||
Reference in New Issue
Block a user