Couldn't find Type for class 'com.badlogic.gdx.maps.objects.RectangleMapObject'

妖精的绣舞 提交于 2020-01-26 03:34:06

问题


Ok, so I made a simple game in libgdx (Android Studio). It works on desktop as well as on Android but in html throws this error :

Uncaught Error: java.lang.RuntimeException: java.lang.RuntimeException: Couldn't find Type for class 'com.badlogic.gdx.maps.objects.RectangleMapObject'

The only code that uses RectangleMapObject in my code is this:

for(MapObject mapObject: tiledMap.getLayers().get(1).getObjects().getByType(RectangleMapObject.class)){
        Rectangle rectangle = ((RectangleMapObject)mapObject).getRectangle();
        createGround(rectangle.getX()/ 70f, rectangle.getY() / 70f, rectangle.getWidth() / 70f, rectangle.getHeight()/70f);
}

I spent almost two days trying to make it work and found nothing. If someone knows the solution to this problem, Its cause or anything like that i would realy appriciate some help :)


回答1:


Reflection on gwt requires some massaging to work

https://github.com/libgdx/libgdx/wiki/Reflection#gwt


Add this to your GdxDefinition.gwt.xml :

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


来源:https://stackoverflow.com/questions/44719343/couldnt-find-type-for-class-com-badlogic-gdx-maps-objects-rectanglemapobject

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!