本文介绍了找不到类别'com.badlogic.gdx.maps.objects.RectangleMapObject'的类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好,所以我在libgdx(Android Studio)中做了一个简单的游戏.它既可以在台式机上也可以在Android上运行,但是在html中会抛出此错误:

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 :

在我的代码中唯一使用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 :)

推荐答案

对gwt的反思需要一些按摩才能起作用

Reflection on gwt requires some massaging to work

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

将此添加到您的GdxDefinition.gwt.xml:

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

这篇关于找不到类别'com.badlogic.gdx.maps.objects.RectangleMapObject'的类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 14:13