diff options
| author | ilotterytea <iltsu@alright.party> | 2025-01-21 03:17:15 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-01-21 03:17:15 +0500 |
| commit | 1ecd8d1d527b6b66b4746e44023b6ab3cb2ca4cc (patch) | |
| tree | 44a766670059ef3beb1da048844fc7693418bcf8 /html | |
| parent | 4e524d08c5b427cabc1a6e452347c09c963eb86c (diff) | |
feat: using other serializer and gdx-websocket (because the old one doesn't support gwt)
Diffstat (limited to 'html')
| -rw-r--r-- | html/build.gradle | 19 | ||||
| -rw-r--r-- | html/src/main/java/kz/ilotterytea/frogartha/GdxDefinition.gwt.xml | 60 | ||||
| -rw-r--r-- | html/src/main/java/kz/ilotterytea/frogartha/gwt/GwtLauncher.java | 2 |
3 files changed, 45 insertions, 36 deletions
diff --git a/html/build.gradle b/html/build.gradle index 2036b11..89d07bd 100644 --- a/html/build.gradle +++ b/html/build.gradle @@ -1,4 +1,3 @@ - buildscript { repositories { mavenCentral() @@ -14,7 +13,8 @@ apply plugin: "war" apply plugin: "org.gretty" gwt { - gwtVersion = "$gwtFrameworkVersion" // Should match the version used for building the GWT backend. See gradle.properties. + 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' @@ -36,6 +36,9 @@ dependencies { implementation "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources" implementation "com.badlogicgames.gdx:gdx:$gdxVersion:sources" implementation "com.github.mgsx-dev.gdx-gltf:gltf:$gdxGltfVersion:sources" + implementation "com.github.MrStahlfelge.gdx-websockets:core:$gdxWsVersion:sources" + implementation "com.github.MrStahlfelge.gdx-websockets:html:$gdxWsVersion" + implementation "com.github.MrStahlfelge.gdx-websockets:html:$gdxWsVersion:sources" implementation project(':core') } @@ -49,7 +52,7 @@ gretty.resourceBase = "${project.layout.buildDirectory.asFile.get().absolutePath gretty.contextPath = "/" gretty.portPropertiesFileName = "TEMP_PORTS.properties" -task startHttpServer (dependsOn: [draftCompileGwt]) { +task startHttpServer(dependsOn: [draftCompileGwt]) { doFirst { copy { from "webapp" @@ -99,7 +102,7 @@ task dist(dependsOn: [clean, compileGwt]) { file(outputPath).mkdirs() copy { - from("build/gwt/out"){ + from("build/gwt/out") { exclude '**/*.symbolMap' // Not used by a dist, and these can be large. } into outputPath @@ -110,7 +113,7 @@ task dist(dependsOn: [clean, compileGwt]) { 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. @@ -121,7 +124,7 @@ task dist(dependsOn: [clean, compileGwt]) { // either remove or comment out only the "filter" line above this. } into outputPath - } + } copy { from "war" into outputPath @@ -137,7 +140,7 @@ task addSource { } } -task distZip(type: Zip, dependsOn: dist){ +task distZip(type: Zip, dependsOn: dist) { //// This uses the output of the dist task, which removes the superdev button from index.html . from(outputPath) archiveVersion = projectVersion @@ -152,6 +155,6 @@ tasks.checkGwt.dependsOn(addSource) java.sourceCompatibility = JavaVersion.VERSION_11 java.targetCompatibility = JavaVersion.VERSION_11 -sourceSets.main.java.srcDirs = [ "src/main/java/" ] +sourceSets.main.java.srcDirs = ["src/main/java/"] eclipse.project.name = appName + "-html" diff --git a/html/src/main/java/kz/ilotterytea/frogartha/GdxDefinition.gwt.xml b/html/src/main/java/kz/ilotterytea/frogartha/GdxDefinition.gwt.xml index 3f287d1..266f4a8 100644 --- a/html/src/main/java/kz/ilotterytea/frogartha/GdxDefinition.gwt.xml +++ b/html/src/main/java/kz/ilotterytea/frogartha/GdxDefinition.gwt.xml @@ -1,35 +1,39 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.11.0//EN" "https://www.gwtproject.org/doctype/2.11.0/gwt-module.dtd"> +<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.11.0//EN" + "https://www.gwtproject.org/doctype/2.11.0/gwt-module.dtd"> <module rename-to="html"> - <!-- Paths to source are relative to this file and separated by slashes ('/'). --> - <source path="" /> + <!-- Paths to source are relative to this file and separated by slashes ('/'). --> + <source path=""/> - <!-- "Inherits" lines are how GWT knows where to look for code and configuration in other projects or libraries. --> - <inherits name="com.badlogic.gdx.backends.gdx_backends_gwt" /> - <inherits name="GLTF" /> - <inherits name="kz.ilotterytea.frogartha.FrogarthaGame" /> - <inherits name="kz.ilotterytea.frogartha.Shared" /> + <!-- "Inherits" lines are how GWT knows where to look for code and configuration in other projects or libraries. --> + <inherits name="com.badlogic.gdx.backends.gdx_backends_gwt"/> + <inherits name="GLTF"/> + <inherits name="kz.ilotterytea.frogartha.FrogarthaGame"/> + <inherits name="kz.ilotterytea.frogartha.Shared"/> + <inherits name='com.github.czyzby.websocket.GdxWebSocket'/> + <inherits name='com.github.czyzby.websocket.GdxWebSocketGwt'/> + <inherits name='com.github.czyzby.websocket.GdxWebSocketSerialization'/> - <!-- You must change this if you rename packages later, or rename GwtLauncher. --> - <entry-point class="kz.ilotterytea.frogartha.gwt.GwtLauncher" /> + <!-- You must change this if you rename packages later, or rename GwtLauncher. --> + <entry-point class="kz.ilotterytea.frogartha.gwt.GwtLauncher"/> - <!-- Reflection includes may be needed for your code or library code. Each value is separated by periods ('.'). --> - <!-- You can include a full package by not including the name of a type at the end. --> - <!-- This is a feature of libGDX, so these lines go after the above "inherits" that brings in libGDX. --> - <!-- <extend-configuration-property name="gdx.reflect.include" value="fully.qualified.TypeName" /> --> + <!-- Reflection includes may be needed for your code or library code. Each value is separated by periods ('.'). --> + <!-- You can include a full package by not including the name of a type at the end. --> + <!-- This is a feature of libGDX, so these lines go after the above "inherits" that brings in libGDX. --> + <!-- <extend-configuration-property name="gdx.reflect.include" value="fully.qualified.TypeName" /> --> - <!-- Rarely, projects may need to include files but do not have access to the complete assets. --> - <!-- This happens for libraries and shared projects, typically, and the configuration goes in that project. --> - <!-- The value is a path, separated by forward slashes, where the root is your html project's resources root. --> - <!-- You can include individual files like this, and access them with Gdx.files.classpath("path/to/file.png") : --> - <!-- This is also a feature of libGDX, so these lines go after the above "inherits" that brings in libGDX. --> - <!-- <extend-configuration-property name="gdx.files.classpath" value="path/to/file.png" /> --> + <!-- Rarely, projects may need to include files but do not have access to the complete assets. --> + <!-- This happens for libraries and shared projects, typically, and the configuration goes in that project. --> + <!-- The value is a path, separated by forward slashes, where the root is your html project's resources root. --> + <!-- You can include individual files like this, and access them with Gdx.files.classpath("path/to/file.png") : --> + <!-- This is also a feature of libGDX, so these lines go after the above "inherits" that brings in libGDX. --> + <!-- <extend-configuration-property name="gdx.files.classpath" value="path/to/file.png" /> --> - <!-- You usually won't need to make changes to the rest of this. --> - <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>
\ No newline at end of file + <!-- You usually won't need to make changes to the rest of this. --> + <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> diff --git a/html/src/main/java/kz/ilotterytea/frogartha/gwt/GwtLauncher.java b/html/src/main/java/kz/ilotterytea/frogartha/gwt/GwtLauncher.java index a4e7ea3..bafa596 100644 --- a/html/src/main/java/kz/ilotterytea/frogartha/gwt/GwtLauncher.java +++ b/html/src/main/java/kz/ilotterytea/frogartha/gwt/GwtLauncher.java @@ -3,6 +3,7 @@ package kz.ilotterytea.frogartha.gwt; import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.backends.gwt.GwtApplication; import com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration; +import com.github.czyzby.websocket.GwtWebSockets; import kz.ilotterytea.frogartha.FrogarthaGame; /** @@ -23,6 +24,7 @@ public class GwtLauncher extends GwtApplication { @Override public ApplicationListener createApplicationListener() { + GwtWebSockets.initiate(); return FrogarthaGame.getInstance(); } } |
