J'ai trouvé la réponse sur this BitBucket repo. Le fichier README donne une bonne explication de la façon de l'implémenter en utilisant Gradle.
Fondamentalement, vous ajoutez juste GdxTestRunner.java de cette prise en pension, puis ajoutez un @RunWith
à chacun de vos fichiers de test:
@RunWith(GdxTestRunner.class)
public class MyClassTest {
...
}
Ensuite, dans votre fichier racine build.gradle
, ajouter quelque chose comme ceci à vos core
dépendances:
testCompile "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"
testCompile "com.badlogicgames.gdx:gdx:$gdxVersion"
testCompile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
testCompile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
testCompile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
testCompile "com.badlogicgames.gdx:gdx-bullet:$gdxVersion"
testCompile "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-desktop"
Il est évident que les dépendances ne sont box2d
et bullet
nécessaire si vous utilisez ces bibliothèques.
Sur le README repo BitBucket, l'exemple inclut à la fois
testCompile "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"
et
compile "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"
Je ne pense pas qu'il est nécessaire d'inclure cela pour compile
, et si je me Comprendre comment fonctionne Gradle, cela ralentira votre construction.
ici pour télécharger: http://libgdx.badlogicgames.com/releases/ Voici des explications: http://agmprojects.com/blog/setting-up-a-basic-libgdx-project – Guillaume
Je suppose que je devrait avoir mentionné que j'utilise IntelliJ IDEA et le LibGDX-setup-ui. J'ai vu ce tutoriel auparavant, mais comme il est basé sur un projet Eclipse personnalisé, je n'arrive pas à le faire fonctionner dans mon projet. – twiz
Peut être utile: http://stackoverflow.com/questions/1051640/correct-way-to-add-lib-jar-to-an-intellij-idea-project – Guillaume