Initial Commit

This commit is contained in:
2025-07-21 12:20:41 +02:00
commit 03a60da816
49 changed files with 4542 additions and 0 deletions
+153
View File
@@ -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();
}
}
+3
View File
@@ -0,0 +1,3 @@
<?xml version="1.0" ?>
<web-app>
</web-app>
+31
View File
@@ -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">&#8635;</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>
Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

+53
View File
@@ -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);
}