che*_*o_c 7 gwt inheritance android project libgdx
我正在尝试启动我的Html项目,但我遇到了一些问题.桌面和Android项目运作良好.问题是我有一个其他项目我用作未导入的库或其他东西.
[ERROR] [com.mobilecostudios.walkingskeleton.GwtDefinition] - Errors in 'file:/C:/Users/chelo/Documents/mobilecostudios-libgdx/trunk/walkingskeleton/WalkingSkeleton/src/com/mobilecostudios/walkingskeleton/GameLoop.java'
[ERROR] [com.mobilecostudios.walkingskeleton.GwtDefinition] - Line 21: No source code is available for type com.mobilecostudios.gamelibrary.Domain.BaseSprite; did you forget to inherit a required module?
Run Code Online (Sandbox Code Playgroud)
我的项目层次结构是:
我的gwt.xml是:
<?xml version="1.0" encoding="UTF-8"?>
<!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">
<module>
<inherits name='com.badlogic.gdx.backends.gdx_backends_gwt' />
<inherits name='GameLoop' />
<entry-point class='com.mobilecostudios.walkingskeleton.client.GwtLauncher' />
<set-configuration-property name="gdx.assetpath" value="../WalkingSkeleton-android/assets" />
</module>
Run Code Online (Sandbox Code Playgroud)
我已经将proyect添加到构建路径中了.我还缺少什么?
构建路径
您必须确保还将项目的源代码添加到路径中.将在客户端使用的任何GWT Java模块都需要提供其源代码.
在你的情况下,
<inherits name='GameLoop' />
Run Code Online (Sandbox Code Playgroud)
应该:
<inherits name='com.mobilecostudios.walkingskeleton.GameLoop' />
Run Code Online (Sandbox Code Playgroud)
另外,哪里com.mobilecostudios.gamelibrary.Domain.BaseSprite
来了?如果它是客户端使用,则需要将其添加到模块.gwt.xml
文件中.应该是这样的:
<inherits name='com.mobilecostudios.gamelibrary.GameLibrary' />
Run Code Online (Sandbox Code Playgroud)
上面,我假设这GameLibrary.gwt.xml
是包含项目的GWT模块XML文件com.mobilecostudios.gamelibrary.Domain.BaseSprite
.
基本上,当您想在客户端的项目中使用外部GWT模块时,需要通过将源和二进制文件添加到构建路径中将其导入到项目中,并且还需要将一个外部GWT模块添加<inherits name='...'>
到.gwt.xml
项目的文件中.
对于具有多个软件包的项目,必须为正在使用的每个软件包添加一个.gwt.xml:
如上图所示,我为控制器的object.gwt.xml等添加了controller.gwt.xml……在这些.gwt.xml文件中,您必须编写如下内容:
<?xml version="1.0" encoding="UTF-8"?>
<!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">
<module>
<source path="com/me/controller" />
</module>
Run Code Online (Sandbox Code Playgroud)
例如,这是我的controller.gwt.xml,然后将继承标签添加到您的GwtDefinition.gwt.xml文件中,如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<!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">
<module>
<inherits name='com.badlogic.gdx.backends.gdx_backends_gwt' />
<inherits name='MyGdxGame' />
<inherits name='objects' />
<inherits name='settings' />
<inherits name='controller' />
<entry-point class='com.me.mygdxgame.client.GwtLauncher' />
<set-configuration-property name="gdx.assetpath" value="../cannongame-android/assets" />
</module>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4106 次 |
最近记录: |