xpenatan / gdx-teavm Goto Github PK
View Code? Open in Web Editor NEWWIP. Run Libgdx in a webbrowser with teavm
License: Apache License 2.0
WIP. Run Libgdx in a webbrowser with teavm
License: Apache License 2.0
When i start my application in browser js console i see warning
unreachable code after return statement
for this generate js code:
dragomeJs.StringInit$$init_$void = function()
{
return "";
return this;
};
dragomeJs.StringInit$$init____java_lang_String$void = function(value)
{
return value.$toString$java_lang_String();
return this;
};
dragomeJs.StringInit$$init____char_ARRAYTYPE$void = function(data)
{
return java_lang_String.$valueOf___char_ARRAYTYPE$java_lang_String(data);
return this;
};
dragomeJs.StringInit$$init____char_ARRAYTYPE__int__int$void = function(data, offset, count)
{
return java_lang_String.$valueOf___char_ARRAYTYPE__int__int$java_lang_String(data, offset, count);
return this;
};
dragomeJs.StringInit$$init____byte_ARRAYTYPE__int__int__java_lang_String$void = function(bytes, offset, count, enc)
{
return java_lang_String.$init___byte_ARRAYTYPE__int__int__java_lang_String$java_lang_String(bytes, offset, count, enc);
return this;
};
dragomeJs.StringInit$$init____byte_ARRAYTYPE__java_lang_String$void = function(bytes, enc)
{
return java_lang_String.$init___byte_ARRAYTYPE__int__int__java_lang_String$java_lang_String(bytes, 0, bytes.length, enc);
return this;
};
dragomeJs.StringInit$$init____byte_ARRAYTYPE__int__int$void = function(bytes, offset, count)
{
return java_lang_String.$init___byte_ARRAYTYPE__int__int__java_lang_String$java_lang_String(bytes, offset, count, null);
return this;
};
dragomeJs.StringInit$$init____byte_ARRAYTYPE$void = function(bytes)
{
return java_lang_String.$init___byte_ARRAYTYPE__int__int__java_lang_String$java_lang_String(bytes, 0, bytes.length, null);
return this;
};
dragomeJs.StringInit$$init____java_lang_StringBuffer$void = function(buffer)
{
return buffer.$toString$java_lang_String();
return this;
};
All string function have dublicate return statement.
@fpetrola @xpenatan i see that you something done in string dragome/dragome-sdk@71a458b
Can you also fix this warning?
https://github.com/dragome/dragome-sdk
Java 8 ready. Build your pages using lambda expressions, default methods, streams
but
I have this synthetic code:
====================================================
Supplier.java
public interface Supplier<T> {
public T get();
}
ObjectPool.java
public class ObjectPool<T> {
private final Supplier<T> supplier;
private ObjectPool(final Supplier<T> supplier) {
this.supplier = supplier;
}
public T get() {
return supplier.get();
}
public static <T> ObjectPool<T> create(final Supplier<T> supplier) {
return new ObjectPool<>(supplier);
}
}
NodeOverlapCallback.java
public abstract class NodeOverlapCallback {
public abstract void processNode();
}
MyNodeOverlapCallback.java
public class MyNodeOverlapCallback extends NodeOverlapCallback {
@Override
public void processNode() {
// DO SOMETHING
}
}
====================================================
Now if i do like this:
final ObjectPool<MyNodeOverlapCallback> myNodeCallbacks = ObjectPool.create(
new Supplier<MyNodeOverlapCallback>() {
@Override
public MyNodeOverlapCallback get() {
return new MyNodeOverlapCallback();
}
});
final MyNodeOverlapCallback myNodeCallback = myNodeCallbacks.get();
myNodeCallback.processNode();
All work well after dragome js codegen
But if i do like this:
final ObjectPool<MyNodeOverlapCallback> myNodeCallbacks = ObjectPool.create(
() -> new MyNodeOverlapCallback()
);
final MyNodeOverlapCallback myNodeCallback = myNodeCallbacks.get();
myNodeCallback.processNode();
Browser write javascript error that myNodeCallback is null;
But both implimentation work correct as java code.
P.S.: also repost to dragome/dragome-sdk#147
There is a memory leak issue. If you build multiple times using the IDEA the memory in task manager keeps increasing
In browser js console error:
The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol.
Please add
<meta charset="utf-8">
in https://github.com/xpenatan/gdx-shadertoy/blob/master/dragome/webapp/index.html
We didn't get an update for a while and there are a few bugfixes. Would it be possible to create a new release 1.0.0-b5?๐
Hi,
I was working on rewriting some old game to Kotlin and made a fresh new project with gdx-liftoff. I tried the teavm launcher at the beginning with a basic rendering setup and the ECS library with some components and systems. Everything was working great!
Now I added some new features mainly related to Box2D and now the compilation fails and I have no idea what is causing it :(
Here is the project: https://github.com/Quillraven/MysticGarden/tree/kotlin
Here is the stacktrace:
java.lang.ArrayIndexOutOfBoundsException: arraycopy: length -1 is negative
at java.base/java.lang.System.arraycopy(Native Method)
at java.base/java.util.Arrays.copyOfRange(Arrays.java:3895)
at org.teavm.common.IrreducibleGraphSplitter.handleStronglyConnectedComponent(IrreducibleGraphSplitter.java:313)
at org.teavm.common.IrreducibleGraphSplitter.handleIrreducibleChildren(IrreducibleGraphSplitter.java:241)
at org.teavm.common.IrreducibleGraphSplitter.splitLoops(IrreducibleGraphSplitter.java:220)
at org.teavm.common.GraphUtils.splitIrreducibleGraph(GraphUtils.java:361)
at org.teavm.model.util.AsyncProgramSplitter.split(AsyncProgramSplitter.java:201)
at org.teavm.ast.decompilation.Decompiler.decompileAsync(Decompiler.java:142)
at org.teavm.backend.javascript.JavaScriptTarget.decompileAsync(JavaScriptTarget.java:637)
at org.teavm.backend.javascript.JavaScriptTarget.decompile(JavaScriptTarget.java:595)
at org.teavm.backend.javascript.JavaScriptTarget.decompile(JavaScriptTarget.java:563)
at org.teavm.backend.javascript.JavaScriptTarget.modelToAst(JavaScriptTarget.java:516)
at org.teavm.backend.javascript.JavaScriptTarget.emit(JavaScriptTarget.java:355)
at org.teavm.backend.javascript.JavaScriptTarget.emit(JavaScriptTarget.java:336)
at org.teavm.vm.TeaVM.build(TeaVM.java:422)
at org.teavm.tooling.TeaVMTool.generate(TeaVMTool.java:433)
at com.github.xpenatan.gdx.backends.teavm.TeaBuilder.build(TeaBuilder.java:112)
at com.github.xpenatan.gdx.backends.teavm.TeaBuilder.build(TeaBuilder.java:105)
at com.github.quillraven.mysticgarden.teavm.TeaVMBuilder.main(TeaVMBuilder.kt:27)
Any hint is appreciated to find out the root cause of this issue.
Thank you!
Implement a way to add a startup app loading which anyone can customize.
Something like with GWT backend which have the default loading logic.
Or a secondary application listener which is executed first while loading libs, assets, etc.
| ERROR[0]
| Class: com/github/xpenatan/gdx/backends/teavm/TeaJSGraphics.java:42
| Method: com.github.xpenatan.gdx.backends.teavm.TeaJSGraphics.setFullscreenJSNI(Lcom/github/xpenatan/gdx/backends/web/WebGraphics;Lcom/github/xpenatan/gdx/backends/web/dom/HTMLCanvasElementWrapper;II)Z
| Text: Method com.github.xpenatan.gdx.backends.teavm.TeaJSGraphics.setFullscreen(Lcom/github/xpenatan/gdx/backends/teavm/TeaJSGraphics$FullscreenChanged;Lcom/github/xpenatan/gdx/backends/web/dom/HTMLCanvasElementWrapper;II)Z is not a proper native JavaScript method declaration: its 2th parameter has wrong type
|
| ----
|
| ERROR[1]
| Class: com/github/xpenatan/gdx/backends/teavm/TeaJSApplication.java:11
| Method: com.github.xpenatan.gdx.backends.teavm.TeaJSApplication.access$200(Lcom/github/xpenatan/gdx/backends/web/dom/typedarray/ArrayBufferWrapper;Lcom/github/xpenatan/gdx/backends/teavm/TeaJSApplication$BulletPhysicsLoadFunction;)V
| Text: Method com.github.xpenatan.gdx.backends.teavm.TeaJSApplication.initBulletWasm(Lcom/github/xpenatan/gdx/backends/web/dom/typedarray/ArrayBufferWrapper;Lcom/github/xpenatan/gdx/backends/teavm/TeaJSApplication$BulletPhysicsLoadFunction;)V is not a proper native JavaScript method declaration: its 1th parameter has wrong type
I've checked the methods, I don't see what's wrong or how they should be modified. I've checked the teavm sources and it should be supported because it's an interface. I don't understand why this error is happening.
This occurs when running the dist jar in console. I also tried to debug in Android Studio but I kept getting out of heap space even though I already set -Xmx8192m in JVM options in the run configurations (not sure why maybe it's not working):
org.teavm.hppc.BufferAllocationException: Not enough memory to allocate buffers for rehashing: 0 -> 65,536
at org.teavm.hppc.IntHashSet.allocateBuffers(IntHashSet.java:739)
at org.teavm.hppc.IntHashSet.ensureCapacity(IntHashSet.java:364)
at org.teavm.hppc.IntHashSet.<init>(IntHashSet.java:129)
at org.teavm.hppc.IntHashSet.<init>(IntHashSet.java:110)
at org.teavm.hppc.IntHashSet.<init>(IntHashSet.java:101)
at org.teavm.dependency.DependencyAnalyzer.schedulePropagation(DependencyAnalyzer.java:352)
at org.teavm.dependency.DependencyNode.scheduleMultipleTypes(DependencyNode.java:189)
at org.teavm.dependency.Transition.mergeDomains(Transition.java:69)
at org.teavm.dependency.Transition.propagate(Transition.java:61)
at org.teavm.dependency.Transition.consume(Transition.java:151)
at org.teavm.dependency.DependencyAnalyzer.schedulePropagation(DependencyAnalyzer.java:347)
at org.teavm.dependency.DependencyNode.scheduleMultipleTypes(DependencyNode.java:189)
at org.teavm.dependency.DependencyNode.propagate(DependencyNode.java:144)
at org.teavm.dependency.DependencyNode.connectWithoutChildNodes(DependencyNode.java:320)
at org.teavm.dependency.DependencyNode.connect(DependencyNode.java:271)
at org.teavm.dependency.DependencyNode.connect(DependencyNode.java:394)
at org.teavm.dependency.VirtualCallConsumer.consume(VirtualCallConsumer.java:91)
at org.teavm.dependency.DependencyAnalyzer.schedulePropagation(DependencyAnalyzer.java:309)
at org.teavm.dependency.DependencyNode.scheduleSingleType(DependencyNode.java:96)
at org.teavm.dependency.DependencyNode.propagate(DependencyNode.java:68)
at org.teavm.dependency.Transition.propagate(Transition.java:51)
at org.teavm.dependency.Transition.consume(Transition.java:39)
at org.teavm.dependency.DependencyAnalyzer.processNodeToNodeTransitionQueue(DependencyAnalyzer.java:669)
at org.teavm.dependency.DependencyAnalyzer.processQueue(DependencyAnalyzer.java:641)
at org.teavm.dependency.DependencyAnalyzer.processDependencies(DependencyAnalyzer.java:683)
at org.teavm.vm.TeaVM.build(TeaVM.java:379)
at com.github.xpenatan.gdx.backends.teavm.CustomTeaVMTool.generate(CustomTeaVMTool.java:402)
at com.github.xpenatan.gdx.backends.teavm.TeaBuilder.build(TeaBuilder.java:201)
at com.github.xpenatan.gdx.html5.generator.core.viewmodel.GeneratorViewModel$1.run(GeneratorViewModel.java:78)
Caused by: java.lang.OutOfMemoryError: Java heap space
at org.teavm.hppc.IntHashSet.allocateBuffers(IntHashSet.java:736)
... 28 more
Otherwise, is there any way to add the backend to my existing libgdx project instead of using the generator? My project uses gdx-liftoff.
I'm trying to use this plugin to export my LibKTX code. The code is pretty simple and just makes use of graphics, scene2d and assetloader. I get this error when I try to run jettyRun:
Exception in thread "main" java.lang.NullPointerException: Cannot invoke method getText() on null object
at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:91)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:35)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at org.akhikhl.gretty.Runner.initLogback(Runner.groovy:65)
at org.akhikhl.gretty.Runner$initLogback.callStatic(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:56)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:194)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:206)
at org.akhikhl.gretty.Runner.run(Runner.groovy:115)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:71)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
at org.akhikhl.gretty.Runner.main(Runner.groovy:44)
Exception in thread "Thread-30" org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Amazon Corretto\jdk11.0.5_10\bin\java.exe'' finished with non-zero exit value 1
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:395)
at org.gradle.process.internal.DefaultJavaExecAction.execute(DefaultJavaExecAction.java:37)
at org.gradle.api.internal.file.DefaultFileOperations.javaexec(DefaultFileOperations.java:192)
at org.gradle.api.internal.project.DefaultProject.javaexec(DefaultProject.java:1087)
at org.gradle.api.internal.project.DefaultProject.javaexec(DefaultProject.java:1082)
at org.gradle.api.Project$javaexec$5.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at org.akhikhl.gretty.DefaultLauncher.javaExec(DefaultLauncher.groovy:89)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:384)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
at org.akhikhl.gretty.LauncherBase$_launchThread_closure4.doCall(LauncherBase.groovy:256)
at org.akhikhl.gretty.LauncherBase$_launchThread_closure4.doCall(LauncherBase.groovy)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at groovy.lang.Closure.call(Closure.java:414)
at groovy.lang.Closure.call(Closure.java:408)
at groovy.lang.Closure.run(Closure.java:495)
at java.base/java.lang.Thread.run(Thread.java:834)
> Task :dragome:jettyRun
http://www.badlogicgames.com/wordpress/?p=3984#comments
Maybe need update dependence gdx-dragome-backend and gdx-shadertoy.
It was updated to latest Sound Manager 2 in new libGDX, maybe need update https://github.com/xpenatan/gdx-dragome-backend/releases/download/LIB/soundmanager2-jsmin.js too.
Can you support gdx-freetype extension https://github.com/libgdx/libgdx/tree/master/extensions/gdx-freetype like you support bullet extension in web version?
Hi, I tried many things with configurations but I wasn't able to identify the real cause of this issue.. In complex games which have many dependencies compilation doesn't work producing this strange $$__annotations__$$
error
#################################################################
|
| DEPENDENCY_ANALYSIS
|
#################################################################
|||||||||||||||||||||||||||||||||||||java.lang.IllegalArgumentException: Illegal type signature: Lcom/badlogic/gdx/graphics/VertexAttributes$ReadonlyIterable;$$__annotations__$$
at org.teavm.model.ValueType.parse(ValueType.java:313)
at org.teavm.dependency.DependencyAnalyzer.getSuperClassFilter(DependencyAnalyzer.java:854)
at org.teavm.dependency.DependencyNode.getFilter(DependencyNode.java:249)
at org.teavm.dependency.DependencyNode.filter(DependencyNode.java:235)
at org.teavm.dependency.DependencyNode.propagate(DependencyNode.java:64)
at org.teavm.classlib.java.lang.reflect.AnnotationDependencyListener.createAnnotationClass(AnnotationDependencyListener.java:193)
at org.teavm.classlib.java.lang.reflect.AnnotationDependencyListener.lambda$reachGetAnnotations$0(AnnotationDependencyListener.java:164)
at org.teavm.dependency.DependencyAnalyzer.schedulePropagation(DependencyAnalyzer.java:373)
at org.teavm.dependency.DependencyNode.scheduleMultipleTypes(DependencyNode.java:215)
at org.teavm.dependency.Transition.mergeDomains(Transition.java:69)
at org.teavm.dependency.Transition.propagate(Transition.java:61)
at org.teavm.dependency.Transition.consume(Transition.java:151)
at org.teavm.dependency.DependencyAnalyzer.schedulePropagation(DependencyAnalyzer.java:347)
at org.teavm.dependency.DependencyNode.scheduleMultipleTypes(DependencyNode.java:189)
at org.teavm.dependency.Transition.mergeDomains(Transition.java:69)
at org.teavm.dependency.Transition.propagate(Transition.java:61)
at org.teavm.dependency.Transition.consume(Transition.java:151)
at org.teavm.dependency.DependencyAnalyzer.schedulePropagation(DependencyAnalyzer.java:347)
at org.teavm.dependency.DependencyNode.scheduleMultipleTypes(DependencyNode.java:189)
at org.teavm.dependency.Transition.mergeDomains(Transition.java:69)
at org.teavm.dependency.Transition.propagate(Transition.java:61)
at org.teavm.dependency.Transition.consume(Transition.java:151)
at org.teavm.dependency.DependencyAnalyzer.processNodeToNodeTransitionQueue(DependencyAnalyzer.java:676)
at org.teavm.dependency.DependencyAnalyzer.processQueue(DependencyAnalyzer.java:641)
at org.teavm.dependency.DependencyAnalyzer.processDependencies(DependencyAnalyzer.java:683)
at org.teavm.vm.TeaVM.build(TeaVM.java:378)
at org.teavm.tooling.TeaVMTool.generate(TeaVMTool.java:462)
at com.github.xpenatan.gdx.backends.teavm.TeaBuilder.build(TeaBuilder.java:112)
at games.rednblack.hyperrunner.teavm.Build.main(Build.java:31)
I'm really lost because I'm sure that the same project in the past was working and compiling with TeaVM.. Test repo can be found here to reproduce the issue: https://github.com/rednblackgames/tutorial-space-platform
Thanks
Hello!
I've recently played around with this and managed to export to JS with your tool and it surprisingly works fine when running via a local server. I've made a simple pong to try this out.
However, when trying to add the game on itch.io I'm receiving the following error:
(JavaScript) TypeError: can't assign to property Symbol("javaException") on "longjmp": not an object
With more following errors here:
Loading script : https://html.itch.zone/html/6902325/webapp/assets/scripts/box2D.js app.js:469:13
Loading script : https://html.itch.zone/html/6902325/webapp/assets/scripts/freetype.js app.js:469:13
Script loaded: https://html.itch.zone/html/6902325/webapp/assets/scripts/freetype.js 3 app.js:469:13
com.badlogic.gdx.utils.GdxRuntimeException app.js:473:13
Caused by: java.lang.RuntimeException: (JavaScript) TypeError: can't assign to property Symbol("javaException") on "longjmp": not an object app.js:473:13
Uncaught Error: Java exception thrown
$rt_exception https://html.itch.zone/html/6902325/webapp/teavm/app.js:251
$rt_throw https://html.itch.zone/html/6902325/webapp/teavm/app.js:245
cbga_AssetManager_handleTaskError https://html.itch.zone/html/6902325/webapp/teavm/app.js:45256
cbga_AssetManager_update https://html.itch.zone/html/6902325/webapp/teavm/app.js:44970
rt_wrapFunction0 https://html.itch.zone/html/6902325/webapp/teavm/app.js:554
cbga_AssetManager_finishLoading https://html.itch.zone/html/6902325/webapp/teavm/app.js:45018
rt_wrapFunction0 https://html.itch.zone/html/6902325/webapp/teavm/app.js:554
cgkpsu_AssetManager_loadAssets https://html.itch.zone/html/6902325/webapp/teavm/app.js:76569
cgkpss_GameScreen_show https://html.itch.zone/html/6902325/webapp/teavm/app.js:72746
rt_wrapFunction0 https://html.itch.zone/html/6902325/webapp/teavm/app.js:554
ka_KtxGame_setScreen https://html.itch.zone/html/6902325/webapp/teavm/app.js:358786
rt_wrapFunction1 https://html.itch.zone/html/6902325/webapp/teavm/app.js:559
cgkp_Game_create https://html.itch.zone/html/6902325/webapp/teavm/app.js:358906
rt_wrapFunction0 https://html.itch.zone/html/6902325/webapp/teavm/app.js:554
cgxgbw_WebApplication_step https://html.itch.zone/html/6902325/webapp/teavm/app.js:81150
cgxgbw_WebApplication_run https://html.itch.zone/html/6902325/webapp/teavm/app.js:81085
rt_wrapFunction0 https://html.itch.zone/html/6902325/webapp/teavm/app.js:554
cgxgbtdi_TeaWindow_onAnimationFrame https://html.itch.zone/html/6902325/webapp/teavm/app.js:332239
rt_wrapFunction1 https://html.itch.zone/html/6902325/webapp/teavm/app.js:559
cgxgbtdi_TeaWindow_onAnimationFrame$exported$0 https://html.itch.zone/html/6902325/webapp/teavm/app.js:332271
rt_wrapFunction1 https://html.itch.zone/html/6902325/webapp/teavm/app.js:559
fn https://html.itch.zone/html/6902325/webapp/teavm/app.js:89061
app.js:251:15
$rt_exception https://html.itch.zone/html/6902325/webapp/teavm/app.js:251
$rt_throw https://html.itch.zone/html/6902325/webapp/teavm/app.js:245
cbga_AssetManager_handleTaskError https://html.itch.zone/html/6902325/webapp/teavm/app.js:45256
cbga_AssetManager_update https://html.itch.zone/html/6902325/webapp/teavm/app.js:44970
rt_wrapFunction0 https://html.itch.zone/html/6902325/webapp/teavm/app.js:554
cbga_AssetManager_finishLoading https://html.itch.zone/html/6902325/webapp/teavm/app.js:45018
rt_wrapFunction0 https://html.itch.zone/html/6902325/webapp/teavm/app.js:554
cgkpsu_AssetManager_loadAssets https://html.itch.zone/html/6902325/webapp/teavm/app.js:76569
cgkpss_GameScreen_show https://html.itch.zone/html/6902325/webapp/teavm/app.js:72746
rt_wrapFunction0 https://html.itch.zone/html/6902325/webapp/teavm/app.js:554
ka_KtxGame_setScreen https://html.itch.zone/html/6902325/webapp/teavm/app.js:358786
rt_wrapFunction1 https://html.itch.zone/html/6902325/webapp/teavm/app.js:559
cgkp_Game_create https://html.itch.zone/html/6902325/webapp/teavm/app.js:358906
rt_wrapFunction0 https://html.itch.zone/html/6902325/webapp/teavm/app.js:554
cgxgbw_WebApplication_step https://html.itch.zone/html/6902325/webapp/teavm/app.js:81150
cgxgbw_WebApplication_run https://html.itch.zone/html/6902325/webapp/teavm/app.js:81085
rt_wrapFunction0 https://html.itch.zone/html/6902325/webapp/teavm/app.js:554
cgxgbtdi_TeaWindow_onAnimationFrame https://html.itch.zone/html/6902325/webapp/teavm/app.js:332239
rt_wrapFunction1 https://html.itch.zone/html/6902325/webapp/teavm/app.js:559
cgxgbtdi_TeaWindow_onAnimationFrame$exported$0 https://html.itch.zone/html/6902325/webapp/teavm/app.js:332271
rt_wrapFunction1 https://html.itch.zone/html/6902325/webapp/teavm/app.js:559
fn https://html.itch.zone/html/6902325/webapp/teavm/app.js:89061
https://pastebin.com/aSJeXexh
Hoped to see if you would know if there is a work around this by any chance?
Hello @xpenatan and thank you very much for your work!
I'm trying to port my game to html5 and gwt version was awfull...
I have seen your video about TeaVM generator tool but I didn't see any compiled jar on the repo.
So I have cloned your depo and did a ./gradlew build on my desktop but I got the following error build failed :
`
"A problem occurred configuring project ':examples:core:dragome'".
Failed to notify project evaluation listener.
Unsupported servlet container: jetty9"`
So I try at first to replace it with jetty94 and jetty9.4 according to gretty doc but it didn't work either :(
I'm running on java openjdk 11.
Is there a existing generator compiled ?
Thanks you again
@xpenatan, @fpetrola:
It missed this class in generate js code:
com.dragome.commons.DelegateCode
com.dragome.commons.ContinueReflection
Its used in this code:
dragomeJs.addTypeAnnotation("com.dragome.web.html.dom.w3c.MessageEventExtension", "com.dragome.commons.DelegateCode", "::getDataAsString::eval", "this.node.data");
dragomeJs.addTypeAnnotation("com.dragome.web.html.dom.w3c.HTMLImageElementExtension", "com.dragome.commons.DelegateCode", "::getHeightAsInteger::eval", "this.node.height");
dragomeJs.addTypeAnnotation("com.dragome.web.services.RequestExecutorImpl$XMLHttpRequestExtension", "com.dragome.commons.DelegateCode", "::sendSync::eval", "this.node.send($1)");
dragomeJs.addTypeAnnotation("com.dragome.web.html.dom.w3c.HTMLImageElementExtension", "com.dragome.commons.DelegateCode", "::getWidthAsInteger::eval", "this.node.width");
dragomeJs.addTypeAnnotation("com.dragome.web.html.dom.w3c.ArrayBufferFactory", "com.dragome.commons.DelegateCode", "::createArrayBuffer::ignore", "true");
dragomeJs.addTypeAnnotation("com.dragome.utils.DragomeCallsiteFactory$InvocationHandlerForLambdas", "com.dragome.commons.ContinueReflection", "::invoke::", "");
dragomeJs.addTypeAnnotation("com.dragome.services.ServiceInvocation", "com.dragome.commons.ContinueReflection", "::invoke::", "");
All this lines throw ClassNotFoundException here.
Create webapp files automatically without the need to manually add it like: index.html, bullet.js, soundmanager, WEB-INF and dragome-resources so its easier to host it.
Merge error in https://github.com/xpenatan/gdx-dragome-backend/blob/master/backends/gdx-backend-dragome/pom.xml line 78-82
In this file
if (type == ApplicationType.WebGL) {
className = "com.badlogic.gdx.controllers.gwt.GwtControllers";
}
and when i compile program with
-keep class com.badlogic.gdx.controllers.** { *; }
and open in browser. I see in js browser console:
....
ClassNotFoundException - com_badlogic_gdx_controllers_gwt_GwtControllers
....
ReflectionException - Class not found: com.badlogic.gdx.controllers.gwt.GwtControllers
....
GdxRuntimeException - Error creating controller manager: com.badlogic.gdx.controllers.gwt.GwtControllers
....
Be well if gdx-dragome-backend supported controllers api like gwt
https://github.com/libgdx/libgdx/tree/master/extensions/gdx-controllers/gdx-controllers-gwt
Hi there,
are you aware of whether that backend would work with Kotlin language?
Hello!
I wanted to ask if there is a Gradle integration that can be easily added to a project without having to build the generator so that you can simply build js/wasm from your IDE?
When I enable obfuscation, I get the following error:
Uncaught SyntaxError: Unexpected token 'do'
(index):8 Uncaught ReferenceError: main is not defined
Is that a bug? I checked the code, but couldn't quite figure out how it got that way? It seems the main
function/entry point is not generated (or obfuscated)?
EDIT: more details provided!
Please generate and commit next files in
gdx-backend-dragome-1.0.0-NIGHTLIES-sources.jar
gdx-backend-dragome-1.0.0-NIGHTLIES-sources.jar.md5
gdx-backend-dragome-1.0.0-NIGHTLIES-sources.jar.sha1
gdx-backend-dragome-1.0.0-NIGHTLIES-javadoc.jar
gdx-backend-dragome-1.0.0-NIGHTLIES-javadoc.jar.md5
gdx-backend-dragome-1.0.0-NIGHTLIES-javadoc.jar.sha1
something like done this
https://oss.sonatype.org/content/repositories/releases/com/badlogicgames/gdx/gdx-backend-gwt/1.9.5/
Hi!
JBox2D used by libGDX-GWT is commonly known to be a big bottleneck for any 2d physics game made in libGDX for Web, java implementation is just slow compared to the native one, but nowadays there's emscripten and the work you made with Bullet extension for TeaVM shows very great performances! So I was wondering if the same could be made with Box2D to improve performances too.
Thanks :)
Will be very good if you port gdx-test https://github.com/libgdx/libgdx/tree/master/gdx/test/com/badlogic/gdx to test-engine for web dragome.
And check that all test run ok.
I think that perhaps will be trouble with Bits.java because it used bitwise operations with long that do not have full support in javascript.
Bitwise operations are a bit of a hack in Javascript. Since all numbers in Javascript are floating point, and bitwise operators only work on integers, Javascript does a little behind the scenes magic to make it appear bitwise operations are being applied to a 32bit signed integer.
Specifically, Javascript takes the number you are working on and takes the integer portion of the number. It then converts the integer to the most number of bits that number represents, up to 31 bits (1 bit for the sign). So 0 would create a two bit number (1 for the sign, and 1 bit for 0), likewise 1 would create two bits. 2 would create a 3 bit number, 4 would create a 4 bit number, etcโฆ
It's important to realize that you're not guaranteed a 32bit number, for instance running not on zero should, in theory, convert 0 to 4,294,967,295, instead it will return -1 for two reasons, the first being that all numbers are signed in Javascript so "not" always reverses the sign, and second Javascript couldn't make more than one bit from the number zero and not zero becomes one. Therefore ~0=-1.
So bitwise signs in Javascript are up to 32 bits.
https://stackoverflow.com/questions/3081271/number-of-bits-to-represent-a-number
Hello.
I initially used gdx-teavm without Gradle and generated the .js using your generator tool which worked wonders. Right now I'm trying to use the Gradle integration (created project with gdx-liftoff) and I'm facing few problems right now.
One of them is that for whatever reason Gradle TeaVM refuses to compile when using Random UInt generator (using your generator to transpile to JS worked fine). Errors here:
https://pastefy.ga/71byadJi
Changing it to Int worked and removed the errors, however. I'm still plagued with an error of:
com.badlogic.gdx.utils.GdxRuntimeException app.js:25:449
Caused by: java.lang.RuntimeException: (JavaScript) TypeError: b.$array0 is undefined app.js:25:449
Uncaught Error: Java exception thrown
The whole code that I'm trying to build to web is here https://github.com/Its-Kenta/PongKt/tree/test
The old code that I've used to generate .js with your tool is here https://github.com/Its-Kenta/PongKt/tree/main and is also live on itch page which proves that it worked previously and when generated with the tool (albeit that was a while ago)
About slowly compile in #17
When dragome compile java to js it used only one thread.
Maybe there is possibility enable multithreading dragome compile java to js?
In this file DragomeGraphics.java, getDisplayMode()
returns null.
This causes some codes to fail, for example I got a TypeError
(and I cannot catch it). I think this method should return the size of the <canvas>
.
Moreover, other functions should return what it should return instead of null
.
Thank you for fixing them.
Hi it's me again ๐
I was using the b-4 version of gdxTeaVM but i got this error during compilation: | ERROR[0] | Class: de/eskalon/commons/screen/ScreenManager.java:114 | Method: de.eskalon.commons.screen.ScreenManager.<init>()V | Text: Class java.util.concurrent.ConcurrentHashMap was not found
Is this specifically related to ScreenManager or ConcurrentHashMaps in general?
After testing teaVM and GWT with https://github.com/mgsx-dev/gdx-gltf I identified that GWT javascript size is lower compared to teaVM.
4.7mb (teaVM with obfuscated option) and 2.5mb (GWT dist option)
Need to investigate if there is a issue with teaVM.
I was running the teaVM run task on my newly generated gdx project with gdx-liftoff version 1.11.0.7 (I didn't touch the files in the project whatsoever, leaving core untouched with a basic application adapter displaying a black screen), but in the browser i get this error in the javascript console: java.lang.RuntimeException: (JavaScript) ReferenceError: jl_NoClassDefFoundError__init_ is not defined (anonymous) @ app.js:473 app.js:21021 Uncaught ReferenceError: jl_NoClassDefFoundError__init_ is not defined at cgxgbt_TeaLauncher_getApplicationListener (app.js:12769:5) at cgxgbt_TeaLauncher_main (app.js:12749:28) at TeaVMThread.runner (app.js:595:15) at TeaVMThread.run (app.js:21037:23) at TeaVMThread.start (app.js:21024:10) at $rt_startThread (app.js:21070:31) at app.js:594:9 at onload ((index):8:96)
I think this is related to the following error I get in the project's console which says: | Compiler problems | ################################################################# | ERROR[0] | Class: - | Method: - | Text: There's no main class: 'com.alfredo.games.teavm.TeaVMLauncher'
I didn't notice anything weird other than this, thank you in advance for the help.
Hi,
I have a question: how do you distinguish between mobile and desktop browser?
I saw a code snippet like:
val userAgent = Window.Navigator.getUserAgent() ?: ""
if(userAgent.contains("Mobile") || userAgent.contains("Android")) {
// mobile browser
}
but this does not seem to work because of missing GWTBridge class at runtime. Also, it is GWT stuff and I am not sure if this is the correct approach for TeaVM.
In LibGDX itself I only see an ApplicationType which always return WebGL for TeaVM backend. I think you cannot distinguish between mobile and desktop browser with that.
How would you solve that?
Hello :-)
i always take the same jar:
with the build from 09.01.22 my game works fine:
with the latest commits (today) i get issues inside browser:
public class HyperLap2DTest {
public static void main(String[] args) {
URL appJarAppUrl = null;
try {
appJarAppUrl = new File("c:/GitHub/gdx-html5-tools/everrun1.jar").toURI().toURL();
} catch (MalformedURLException e) {
e.printStackTrace();
}
TeaBuildConfiguration teaBuildConfiguration = new TeaBuildConfiguration();
teaBuildConfiguration.assetsPath.add(new File("c:/GitHub/new liftoff/assets"));
teaBuildConfiguration.webappPath = new File("c:/GitHub/gdx-html5-tools").getAbsolutePath();
teaBuildConfiguration.obfuscate = false;
teaBuildConfiguration.mainApplicationClass = "com.tutorial.artemisTestlab.GameMain";
teaBuildConfiguration.additionalClasspath.add(appJarAppUrl);
teaBuildConfiguration.reflectionInclude.add("games.rednblack.editor.renderer");
teaBuildConfiguration.reflectionInclude.add("games.rednblack.h2d.extension.spine");
teaBuildConfiguration.reflectionInclude.add("games.rednblack.h2d.extension.talos");
teaBuildConfiguration.reflectionInclude.add("com.tutorial.artemisTestlab.components");
teaBuildConfiguration.reflectionInclude.add("com.tutorial.artemisTestlab.systems");
teaBuildConfiguration.reflectionInclude.add("com.tutorial.artemisTestlab.Scripts");
teaBuildConfiguration.reflectionInclude.add("com.ray3k.stripe.scenecomposer");
teaBuildConfiguration.reflectionInclude.add("com.artemis");
teaBuildConfiguration.reflectionInclude.add("com.talosvfx.talos.runtime");
teaBuildConfiguration.reflectionExclude.add("com.artemis.annotation");
teaBuildConfiguration.reflectionExclude.add("com.artemis.utils.reflect");
TeaBuilder.build(teaBuildConfiguration);
}
}
Do changes have to be made again?
thanks
we need write many "copy-past" assets paths In method createApplicationListener() in DragomeApplication class
Can it set loadAsset from path mask?
For example as "shaders/*.glsl", etc.
you used jetty plugin for gradle web test
https://github.com/xpenatan/gdx-shadertoy/blob/master/dragome/build.gradle
When try run "jettyRun" task, gradle v3.4 write
The Jetty plugin has been deprecated and is scheduled to be removed in Gradle 4.0. Consider using the Gretty (https://github.com/akhikhl/gretty) plugin instead.
It may be worth to use gretty plugin?
https://discuss.gradle.org/t/future-of-jetty-plugin/18722
This plugin is deprecated and will be removed in Gradle 4.0. Consider using the more feature-rich Gretty plugin instead.
Ok so this is a weird one, I was running my teavm application by using the run command, after that I stopped the execution and made some changes to the files, after that I ran the application again but the server ran the application BEFORE the changes, do I need to reload the project in some way?
Delete key is doing backspace and not delete
I have build error when run jetty (or gretty):
Compiling classes: ...................................................................
Exception in thread "Thread-13" java.lang.RuntimeException: java.lang.NullPointerException
at com.dragome.compiler.DragomeJsCompiler.compile(DragomeJsCompiler.java:170)
at com.dragome.web.helpers.serverside.DragomeCompilerLauncher.compileWithMainClass(DragomeCompilerLauncher.java:71)
at com.dragome.web.serverside.compile.watchers.DirectoryWatcher.compile(DirectoryWatcher.java:263)
at com.dragome.web.serverside.compile.watchers.DirectoryWatcher.startWatching(DirectoryWatcher.java:249)
at com.dragome.web.serverside.servlets.CompilerServlet$1.run(CompilerServlet.java:92)
Caused by: java.lang.NullPointerException
at com.dragome.compiler.Project.visitSuperTypes(Project.java:302)
at com.dragome.compiler.Project.visitSuperTypes(Project.java:305)
at com.dragome.compiler.Project.resolve(Project.java:481)
at com.dragome.compiler.writer.Assembly.resolveNoTainting(Assembly.java:340)
at com.dragome.compiler.DragomeJsCompiler.execute(DragomeJsCompiler.java:259)
at com.dragome.compiler.DragomeJsCompiler.compile(DragomeJsCompiler.java:165)
... 4 more
I found discusion about same issue on groups.google.com/forum
https://groups.google.com/forum/#!topic/dragome/GuFCyGlHiDs
There are two fixed patches in dragome-web
What can it do to fix this problem and apply this patches in dragome upstream?
@fpetrola, @xpenatan, you are mark as contributors in https://github.com/dragome/dragome-sdk/blob/master/dragome-web/src/main/java/com/dragome/web/helpers/serverside/DragomeCompilerLauncher.java
Can you help?
As for now, if your game works fine in GWT and not with teaVM, it may be because some backend code are not implemented yet or is not ported from GWT.
Some examples are WebApplication, WebGraphics and WebInput classes.
Solutions that requires javascript code, there is an example in WebGraphics. It uses a WebJSGraphics interface.
Path to local repository may be different. And need used local maven config in build.gradle for change it without rewrite build.gradle.
Hello :-)
i use a Scene2d clicklistener to change from fullscreen to windowed and back.
Unfortunately this code has no function here:
private void infoTable() {
if (infoButton.getClickListener().isPressed()) {
infoTable.setVisible(true);
}
if (okButton.getClickListener().isPressed()) {
infoTable.setVisible(false);
if (Objects.equals(screensize.getSelected().toString(), "FullScreen")) {
Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
}
if (Objects.equals(screensize.getSelected().toString(), "Windowed")) {
Gdx.graphics.setWindowedMode(800,600);
}
}
}
I can not find example to use bullet extension in gdx-shadertoy
https://github.com/xpenatan/gdx-shadertoy/search?utf8=โ&q=bullet
I see here https://github.com/xpenatan/gdx-dragome-backend/tree/master/extensions/gdx-bullet/gdx-bullet-dragome that it is separate maven project.
Can you deploy it to https://github.com/xpenatan/mvn-repo/tree/master/snapshots/com/badlogicgames/gdx
and write example how config gradle for build project with gdx bullet extension in desctop and web?
Hey,
ive got 3 Compiler problems:
#################################################################
| ERROR[0]
| Class: -
| Method: com.artemis.utils.reflect.ClassReflection.getDeclaredField(Ljava/lang/Class;Ljava/lang/String;)Lcom/artemis/utils/reflect/Field;
| Text: Class java.lang.NoSuchFieldException was not found
|
| ----
|
| ERROR[1]
| Class: com/badlogic/gdx/math/Octree.java:285
| Method: com.badlogic.gdx.math.Octree$OctreeNode.query(Lcom/badlogic/gdx/math/Frustum;Lcom/badlogic/gdx/utils/ObjectSet;)V
| Text: Method com.badlogic.gdx.math.Intersector.intersectFrustumBounds(Lcom/badlogic/gdx/math/Frustum;Lcom/badlogic/gdx/math/collision/BoundingBox;)Z was not found
|
| ----
|
| ERROR[2]
| Class: com/artemis/link/MutatorUtil.java:10
| Method: com.artemis.link.MutatorUtil.getGeneratedMutator(Lcom/artemis/link/LinkSite;)Ljava/lang/Object;
| Text: Method java.lang.Class.getDeclaredClasses()[Ljava/lang/Class; was not found
#################################################################
This is my Buildclass:
public class HyperLap2DTest {
public static void main(String[] args) {
URL appJarAppUrl = null;
try {
appJarAppUrl = new File("c:/GitHub/gdx-html5-tools/everrun1.jar").toURI().toURL();
} catch (MalformedURLException e) {
e.printStackTrace();
}
TeaBuildConfiguration teaBuildConfiguration = new TeaBuildConfiguration();
teaBuildConfiguration.assetsPath.add(new File("c:/GitHub/new liftoff/assets"));
teaBuildConfiguration.webappPath = new File("c:/GitHub/gdx-html5-tools").getAbsolutePath();
teaBuildConfiguration.obfuscate = false;
teaBuildConfiguration.mainApplicationClass = "com.tutorial.artemisTestlab.GameMain";
teaBuildConfiguration.additionalClasspath.add(appJarAppUrl);
teaBuildConfiguration.reflectionInclude.add("games.rednblack.editor.renderer");
teaBuildConfiguration.reflectionInclude.add("games.rednblack.h2d.extension.spine");
teaBuildConfiguration.reflectionInclude.add("games.rednblack.h2d.extension.talos");
teaBuildConfiguration.reflectionInclude.add("com.tutorial.artemisTestlab.components");
teaBuildConfiguration.reflectionInclude.add("com.tutorial.artemisTestlab.systems");
teaBuildConfiguration.reflectionInclude.add("com.tutorial.artemisTestlab.Scripts");
teaBuildConfiguration.reflectionInclude.add("com.ray3k.stripe.scenecomposer");
teaBuildConfiguration.reflectionInclude.add("com.artemis");
teaBuildConfiguration.reflectionInclude.add("com.talosvfx.talos.runtime");
teaBuildConfiguration.reflectionExclude.add("com.artemis.annotation");
teaBuildConfiguration.reflectionExclude.add("com.artemis.utils.reflect");
TeaBuilder.build(teaBuildConfiguration);
}
}
Libgdx Game works in lwjgl3/Android/Gwt.
There was a big hyperlap update to beta, maybe something else needs to be configured...
Edit: Link to web-app:
http://45.133.9.32:8080/everrunTeavm270122/
thanks so far
We are a gamedev team. We are looking for a replacement GWT in libgdx.
I would like to know:
How often do you plan to release gdx-dragome-backend?
Can use gdx-dragome-backend in production code?
For all text asset files that i load like
getPreloader().loadAsset("bdx/shaders/2d/bloom.frag", AssetType.Text, null, new AssetLoaderListener<>());
// and others when i used "AssetType.Text" param
i have error in browser js console:
XML Parsing error: syntax error ... line 1 symbol 1
Why do all text assets load as xml or parse as xml?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.