Search code examples
javahtmlgwtlibgdx

Java --> libGdx project --> Html --> gwt exception --> GWT reflection?


Edited #2

I compiled my libGDX project using gradlew.bat html:dist and got a dist folder with all my assets, html.index, and other files.

I put the dist folder in a zip and uploaded it to itch.io,

The game loads fine and everything seemed to be working as it should.

But the levels are unplayable. I get an error when trying to load the Tiled Map:

enter image description here

But it works fine as a executable .jar file and as an android app. The html version seems to have a problem loading objects from the tiled map.

Update

I think I need to use reflection, but I'm not sure how in this case.

Code I think is the problem:

for(MapObject object : map.getLayers().get(1).getObjects().getByType(RectangleMapObject.class)) {...}

Is this the right way to reflect this object, by just adding this to my GdxDefinition.gwt.xml: ?

 <extend-configuration-property name="gdx.reflect.include" value="com.badlogic.gdx.maps.objects.RectangleMapObject" />

Also, this line in *.gwt.xml says: "URI not registered"

<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/gwt-module.dtd">

UPDATE

I just added the extended configuration property and it works! Despite the "URI not registered" error.


Solution

  • Needed to use reflection:

    Just added this to my GdxDefinition.gwt.xml:

     <extend-configuration-property name="gdx.reflect.include" value="com.badlogic.gdx.maps.objects.RectangleMapObject" />