Files
06web/build.gradle
T
Dark98 3331ab745b feat(web): add 2006Scape TeaVM WebGL2 client with mobile support and classic 2006 UI
Initializes the TeaVM-based 2006Scape-Web client repository with WebGL2 117HD rendering, WebSocket networking, SpessaSynth MIDI/PCM audio, and mobile-compatible touch/viewport controls. Preserves Revision 377 cache preloading via IndexedDB and localStorage-backed script and config persistence.

### Core Web Runtime & Rendering
- WebLauncher & DesktopHooks:
  - Added TeaVM entry point with URL/localStorage option parsing, async 377 cache preloading, and WebSocket port routing.
  - Implemented DesktopHooks.boxReflectValue using JSWrapper.isJava/maybeUnwrap to box TeaVM reflection primitives, plus localStorage persistence for plugin settings and imported scripts.
- WebHd117Renderer & RSImageProducer:
  - Implemented WebGL2 117HD rendering with 4x4 chunked static scenery VBOs and 0x010203 transparency sentinel so 0x000000 black UI elements stay opaque.
- WebReflectionSupplier:
  - Exposed PluginContext, PluginGraphics, ScriptInterpreter, ID lists, and Math/System/String/collection methods for TeaVM runtime reflection.

### Mobile & Classic 2006 Web UI
- index.html & RSApplet:
  - Styled the page to match the classic 2006 RuneScape webclient with optional classic navbar (auto-hidden below 765px), 1999-2006 Jagex footer, and responsive Fixed/Resizable/Fullscreen scaling.
  - Added Options modal (auto-login, server, world, 117HD, display mode, navbar) with scrollable body in mobile landscape.
  - Implemented Android-parity touch controls (tap, 450ms long-press right-click, 1-finger camera drag, 2-finger pinch zoom clamped to -1..8, and auto-keyboard on input fields).
2026-11-30 20:45:03 +00:00

131 lines
3.9 KiB
Groovy

plugins {
id 'java'
id 'org.teavm' version '0.10.2'
}
group = 'org.scape2006.web'
version = '1.0.0'
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
repositories {
mavenCentral()
}
def findClientDir(String subpath) {
def candidates = [
file("../2006Scape/2006Scape Client/${subpath}"),
file("../../2006Scape/2006Scape Client/${subpath}"),
file("../2006Scape Client/${subpath}")
]
for (cand in candidates) {
if (cand.exists()) return cand
}
return file("../2006Scape/2006Scape Client/${subpath}")
}
def sharedClientSrc = findClientDir("src/main/java")
def sharedClientRes = findClientDir("src/main/resources")
def sharedClientDir = layout.buildDirectory.dir("generated/sources/sharedClient/java")
def syncSharedSources = tasks.register('syncSharedSources') {
inputs.dir(sharedClientSrc)
outputs.dir(sharedClientDir)
doLast {
def targetPkgDir = file("${sharedClientDir.get().asFile}/org/scape2006/web")
targetPkgDir.deleteDir()
targetPkgDir.mkdirs()
def excluded = [
'RSApplet.java', 'RSImageProducer.java', 'RSFrame.java',
'Main.java', 'LocalGame.java', 'Class56_Sub1_Sub1.java',
'DesktopHooks.java', 'AndroidHooks.java', 'DesktopHd117Renderer.java',
'SoundPlayer.java', 'Midi.java', 'Client.java',
'RSSocket.java', 'Signlink.java', 'Decompressor.java',
'ExternalPluginLoader.java'
] as Set
fileTree(sharedClientSrc).visit { element ->
if (element.directory) return
if (excluded.contains(element.name)) return
def dest = new File(targetPkgDir, element.name)
def src = element.file.text
src = src.replace('java.net.Socket', 'org.scape2006.web.net.Socket')
src = src.replace('java.net.InetAddress', 'org.scape2006.web.net.InetAddress')
src = src.replace('java.net.InetSocketAddress', 'org.scape2006.web.net.InetSocketAddress')
if (element.name == 'Game.java') {
src = src.replace('Signlink.reporterror("glfc_ex "', 'Signlink.reporterror("glfc_ex " + _ex + " | "')
}
dest.text = "package org.scape2006.web;\n" + src
}
}
}
sourceSets {
main {
java {
srcDirs = ['src/main/java', sharedClientDir]
}
resources {
srcDirs = ['src/main/resources', sharedClientRes]
}
}
}
tasks.named('compileJava').configure {
dependsOn syncSharedSources
options.encoding = 'UTF-8'
}
dependencies {
implementation teavm.libs.jso
implementation teavm.libs.jsoApis
compileOnly 'org.teavm:teavm-classlib:0.10.2'
compileOnly 'org.teavm:teavm-core:0.10.2'
}
teavm {
all {
mainClass = 'org.scape2006.web.WebLauncher'
}
js {
addedToWebApp = true
targetFileName = 'client.js'
obfuscated = false
sourceMap = true
}
}
tasks.named('generateJavaScript').configure {
doLast {
def jsFile = file("${buildDir}/generated/teavm/js/js/client.js")
if (!jsFile.exists()) {
jsFile = file("${buildDir}/generated/teavm/js/client.js")
}
if (jsFile.exists()) {
def text = jsFile.text
def target = '$rt_createMultiArrayImpl = (cls, arrays, dimensions, start) => {'
if (text.contains(target)) {
jsFile.text = text.replace(target, target + ' start = start | 0;')
}
}
}
}
tasks.register('dist', Copy) {
dependsOn 'generateJavaScript'
from('src/main/webapp')
from(sharedClientRes) {
include 'hud_minimap_bezel.png', 'hud_minimap_hole.png', 'hud_chat_frame.png', 'navbar*.gif'
}
from(layout.buildDirectory.dir('generated/teavm/js')) {
into 'js'
}
into layout.buildDirectory.dir('dist')
}
tasks.named('build').configure {
dependsOn 'dist'
}