diff --git a/SPD-classes/src/main/java/com/watabou/noosa/NoosaScript.java b/SPD-classes/src/main/java/com/watabou/noosa/NoosaScript.java index 102e3320b..3f955cb17 100644 --- a/SPD-classes/src/main/java/com/watabou/noosa/NoosaScript.java +++ b/SPD-classes/src/main/java/com/watabou/noosa/NoosaScript.java @@ -85,17 +85,17 @@ public class NoosaScript extends Script { public void drawElements( FloatBuffer vertices, ShortBuffer indices, int size ) { if (DeviceCompat.isWeb()) { - Gdx.gl30.glBindBuffer(Gdx.gl30.GL_ARRAY_BUFFER, vertexBufferId); + activeGL.glBindBuffer(GL20.GL_ARRAY_BUFFER, vertexBufferId); ((Buffer)vertices).position( 0 ); - Gdx.gl30.glBufferSubData(Gdx.gl30.GL_ARRAY_BUFFER, 0, vertices.remaining() * 4, vertices); + activeGL.glBufferSubData(GL20.GL_ARRAY_BUFFER, 0, vertices.remaining() * 4, vertices); aXY.vertexBuffer(2, 4, 0); aUV.vertexBuffer(2, 4, 2); Quad.releaseIndices(); - Gdx.gl30.glDrawElements( Gdx.gl30.GL_TRIANGLES, size, Gdx.gl30.GL_UNSIGNED_SHORT, indices ); + activeGL.glDrawElements( GL20.GL_TRIANGLES, size, GL20.GL_UNSIGNED_SHORT, indices ); Quad.bindIndices(); - Gdx.gl30.glBindBuffer(Gdx.gl30.GL_ARRAY_BUFFER, 0); + activeGL.glBindBuffer(GL20.GL_ARRAY_BUFFER, 0); } else { ((Buffer)vertices).position( 0 ); aXY.vertexPointer( 2, 4, vertices ); @@ -111,14 +111,14 @@ public class NoosaScript extends Script { public void drawQuad( FloatBuffer vertices ) { if (DeviceCompat.isWeb()) { - Gdx.gl30.glBindBuffer(Gdx.gl30.GL_ARRAY_BUFFER, vertexBufferId); + activeGL.glBindBuffer(GL20.GL_ARRAY_BUFFER, vertexBufferId); ((Buffer)vertices).position( 0 ); - Gdx.gl30.glBufferSubData(Gdx.gl30.GL_ARRAY_BUFFER, 0, vertices.remaining() * 4, vertices); + activeGL.glBufferSubData(GL20.GL_ARRAY_BUFFER, 0, vertices.remaining() * 4, vertices); - Gdx.gl30.glVertexAttribPointer(aXY.location(), 2, Gdx.gl30.GL_FLOAT, false, 4 * 4, 0); - Gdx.gl30.glVertexAttribPointer(aUV.location(), 2, Gdx.gl30.GL_FLOAT, false, 4 * 4, 2 * 4); - Gdx.gl30.glDrawElements( Gdx.gl30.GL_TRIANGLES, Quad.SIZE, Gdx.gl30.GL_UNSIGNED_SHORT, 0 ); - Gdx.gl30.glBindBuffer(Gdx.gl30.GL_ARRAY_BUFFER, 0); + activeGL.glVertexAttribPointer(aXY.location(), 2, GL20.GL_FLOAT, false, 4 * 4, 0); + activeGL.glVertexAttribPointer(aUV.location(), 2, GL20.GL_FLOAT, false, 4 * 4, 2 * 4); + activeGL.glDrawElements( GL20.GL_TRIANGLES, Quad.SIZE, GL20.GL_UNSIGNED_SHORT, 0 ); + activeGL.glBindBuffer(GL20.GL_ARRAY_BUFFER, 0); } else { ((Buffer)vertices).position( 0 ); aXY.vertexPointer( 2, 4, vertices ); @@ -151,16 +151,16 @@ public class NoosaScript extends Script { } if (DeviceCompat.isWeb()) { - Gdx.gl30.glBindBuffer(Gdx.gl30.GL_ARRAY_BUFFER, vertexBufferId); + activeGL.glBindBuffer(GL20.GL_ARRAY_BUFFER, vertexBufferId); ((Buffer)vertices).position( 0 ); - Gdx.gl30.glBufferSubData(Gdx.gl30.GL_ARRAY_BUFFER, 0, vertices.remaining() * 4, vertices); + activeGL.glBufferSubData(GL20.GL_ARRAY_BUFFER, 0, vertices.remaining() * 4, vertices); - Gdx.gl30.glVertexAttribPointer(aXY.location(), 2, Gdx.gl30.GL_FLOAT, false, 4 * 4, 0); - Gdx.gl30.glVertexAttribPointer(aUV.location(), 2, Gdx.gl30.GL_FLOAT, false, 4 * 4, 2 * 4); + activeGL.glVertexAttribPointer(aXY.location(), 2, GL20.GL_FLOAT, false, 4 * 4, 0); + activeGL.glVertexAttribPointer(aUV.location(), 2, GL20.GL_FLOAT, false, 4 * 4, 2 * 4); - Gdx.gl30.glDrawElements( Gdx.gl30.GL_TRIANGLES, Quad.SIZE * size, Gdx.gl30.GL_UNSIGNED_SHORT, 0 ); + activeGL.glDrawElements( GL20.GL_TRIANGLES, Quad.SIZE * size, GL20.GL_UNSIGNED_SHORT, 0 ); - Gdx.gl30.glBindBuffer(Gdx.gl30.GL_ARRAY_BUFFER, 0); + activeGL.glBindBuffer(GL20.GL_ARRAY_BUFFER, 0); } else { ((Buffer)vertices).position( 0 ); aXY.vertexPointer( 2, 4, vertices ); diff --git a/build.gradle b/build.gradle index 6b1ed8d1a..c2e958c95 100644 --- a/build.gradle +++ b/build.gradle @@ -41,4 +41,4 @@ allprojects { maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } } -} \ No newline at end of file +} diff --git a/html/build.gradle b/html/build.gradle index 551223054..1b5c066be 100644 --- a/html/build.gradle +++ b/html/build.gradle @@ -20,6 +20,7 @@ repositories { tasks.register('compileClient', JavaExec) { classpath(sourceSets.main.runtimeClasspath) mainClass.set('com.shatteredpixel.shatteredpixeldungeon.html.Compile') + jvmArgs('-Xms8g', '-Xmx14g', '-Xss16m', '-XX:MaxMetaspaceSize=12g', '-Dfile.encoding=UTF-8') outputs.dir '../release/webapp' doFirst { println "Running compileClient..." diff --git a/html/buildTestWeb.sh b/html/buildTestWeb.sh index b81ed30d9..d1984e2b7 100755 --- a/html/buildTestWeb.sh +++ b/html/buildTestWeb.sh @@ -3,5 +3,5 @@ ../gradlew :html:build wait if [[ -d ../release/webapp/ ]]; then - python3 -m http.server 8100 -d ../release/webapp/ + python3 -m http.server 8000 -d ../release/webapp/ fi diff --git a/html/deployWeb.sh b/html/deployWeb.sh new file mode 100755 index 000000000..378c49200 --- /dev/null +++ b/html/deployWeb.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +TARGET_FOLDER="shatteredPixelDungeon" + +# shellcheck disable=SC2029 +if ssh vps "[[ -d /var/www/$TARGET_FOLDER ]]"; then + ssh vps "find /var/www/$TARGET_FOLDER -mindepth 1 -delete" + scp -r ../release/webapp/* vps:/var/www/$TARGET_FOLDER +fi diff --git a/html/src/main/java/Compile.java b/html/src/main/java/Compile.java index 8405f945c..0e615889a 100644 --- a/html/src/main/java/Compile.java +++ b/html/src/main/java/Compile.java @@ -1,4 +1,4 @@ -/* +/* * 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: @@ -7,7 +7,7 @@ * * This file is derived from micronaut-libgdx-teavm (https://github.com/hollingsworthd/micronaut-libgdx-teavm), * originally licensed under the Apache License, Version 2.0. - * + * * Modifications made by Konsthol on 13/4/25: * - Adjusted to compile Shattered Pixel Dungeon *