libgdx 实用程序 HTML

libgdx utils HTML

我尝试使用 http://dermetfan.net/

中的 libgdx 实用程序 GWT 编译我的 libgdx 项目

我有一个与 Can't Run html libgdx with libgdx-utils

非常相似的问题

但没有任何帮助...

我已经一步步完成了,编辑我的 build.gradle (https://bitbucket.org/dermetfan/libgdx-utils/wiki/Dependency%20Instructions)

现在看起来像:

buildscript {
    repositories {
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        jcenter()
    }
    dependencies {
        classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
        classpath 'com.android.tools.build:gradle:1.2.3'
    }
}

allprojects {
    apply plugin: "eclipse"
    apply plugin: "idea"

    version = '1.0'
    ext {
        appName = 'TEST'
        gdxVersion = '1.6.2'
        roboVMVersion = '1.3.0'
        box2DLightsVersion = '1.3'
        ashleyVersion = '1.4.0'
        aiVersion = '1.5.0'
        gdxUtilsVersion = '0.11.0'
        gdxUtilssVersion = '0.13.1'
    }

    repositories {
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        maven { url "https://oss.sonatype.org/content/repositories/releases/" }
    }
}

project(":core") {
    apply plugin: "java"


    dependencies {
        compile "com.badlogicgames.gdx:gdx:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"

        compile "net.dermetfan.libgdx-utils:libgdx-utils:$gdxUtilssVersion"
        compile "net.dermetfan.libgdx-utils:libgdx-utils-box2d:$gdxUtilssVersion"
    }
}

project(":desktop") {
    apply plugin: "java"


    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
        compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
    }
}

project(":android") {
    apply plugin: "android"

    configurations { natives }

    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
    }
}

project(":html") {
    apply plugin: "gwt"
    apply plugin: "war"



    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
        compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion:sources"
        compile "com.badlogicgames.gdx:gdx-box2d-gwt:$gdxVersion:sources"
        compile "net.dermetfan.libgdx-utils:libgdx-utils-box2d-gwt:$gdxUtilsVersion:sources"
    }
}



tasks.eclipse.doLast {
    delete ".project"
}

错误:

Compiling module com.adacho.test.GdxDefinition
   Validating units:
      [ERROR] Errors in 'file:/C:/ADACHO/LibGDX%20-%20Projekty/PROJEKTY/TEST/core/src/com/adacho/test/obiekty/Ground.java'
         [ERROR] Line 21: No source code is available for type net.dermetfan.gdx.graphics.g2d.Box2DSprite; did you forget to inherit a required module?
      [ERROR] Errors in 'file:/C:/ADACHO/LibGDX%20-%20Projekty/PROJEKTY/TEST/core/src/com/adacho/test/obiekty/MovingPlatform.java'
         [ERROR] Line 26: No source code is available for type net.dermetfan.gdx.graphics.g2d.Box2DSprite; did you forget to inherit a required module?
      [ERROR] Errors in 'file:/C:/ADACHO/LibGDX%20-%20Projekty/PROJEKTY/TEST/core/src/com/adacho/test/obiekty/Postac.java'
         [ERROR] Line 47: No source code is available for type net.dermetfan.gdx.graphics.g2d.AnimatedBox2DSprite; did you forget to inherit a required module?
         [ERROR] Line 88: No source code is available for type net.dermetfan.gdx.graphics.g2d.AnimatedSprite; did you forget to inherit a required module?
   [ERROR] Aborting compile due to errors in some input files

让我吃惊的是当我清除我的 build.gradle 没有任何变化?哪里有问题?请帮助我,我花了几天时间解决这个问题...

GWT 编译器说:

No source code is available for type net.dermetfan.gdx.graphics.g2d.AnimatedSprite
No source code is available for type net.dermetfan.gdx.graphics.g2d.Box2DSprite

AnimatedSprite 位于 libgdx-utils.
Box2DSprite 居住在 libgdx-utils-box2d.

显然 GWT 缺少这些库的源代码,因此您需要将它们添加到 HTML 项目的依赖项中。

您的 HTML 项目的依赖项现在应该如下所示:

compile "net.dermetfan.libgdx-utils:libgdx-utils:$gdxUtilsVersion:sources"
compile "net.dermetfan.libgdx-utils:libgdx-utils-box2d:$gdxUtilsVersion:sources" // Box2D module (sources)
compile "net.dermetfan.libgdx-utils:libgdx-utils-box2d-gwt:$gdxUtilsVersion:sources" // Box2D module GWT specific classes (sources)

libgdx-utils-box2d-gwt 仅包含 GWT 特定 类,不包含 libgdx-utils-box2d 中的所有内容。事实上,我希望在未来的某个时候完全删除 libgdx-utils-box2d-gwt

wiki 上的示例构建脚本似乎有同样的问题,对此深表歉意。