LibGDX Project Setup

Paweł Pastuszak edited this page Jun 26, 2016 · 33 revisions

In order to load exported project from VisEditor you need to add VisRuntime dependency to your LibGDX project. Please refer to LibGDX documentaion if you don't know how to mange dependencies with Gradle. Alternatively JAR can be downloaded from Maven repository. If you are creating new project, you can use gdx-setup to automatically add VisRuntime for you. (press 'Show Third Party Extension' button)

PSA: Since 0.3.3 GWT platform will be no longer supported.

Manual Gradle setup:

Open build.gradle in project root. In ext section under allprojects add:

visRuntimeVersion = '0.3.2'

Core dependency

compile "com.kotcrab.vis:vis-runtime:$visRuntimeVersion"

HTML dependency

compile "net.onedaybeard.artemis:artemis-odb-gwt:1.3.1"
compile "net.onedaybeard.artemis:artemis-odb-gwt:1.3.1:sources"
compile "net.onedaybeard.artemis:artemis-odb:1.3.1:sources"
compile "com.kotcrab.vis:vis-runtime-gwt:$visRuntimeVersion"
compile "com.kotcrab.vis:vis-runtime-gwt:$visRuntimeVersion:sources"
compile "com.kotcrab.vis:vis-runtime:$visRuntimeVersion:sources"

Refresh Gradle dependencies.

GdxDefinition.gwt.xml and GdxDefinitionSuperdev.gwt.xml (only if you are using HTML)

<inherits name='com.kotcrab.vis.vis-runtime' />

In same files declare your packages with components and systems like here:

<extend-configuration-property name="artemis.reflect.include" value="com.kotcrab.vis.demo.jumper.component" />
<extend-configuration-property name="artemis.reflect.include" value="com.kotcrab.vis.demo.jumper.system" />
<extend-configuration-property name="artemis.reflect.include" value="com.kotcrab.vis.demo.jumper.manager" />

LibGDX compatibility

Table bellows shows what version of LibGDX you need for your version of VisRuntime. It also shows what Artemis-odb version is using VisRuntime.

VisRuntime Artemis-odb LibGDX
0.2.0 0.10.2 1.6.4
0.2.1 0.10.2 1.6.4
0.2.2 0.10.2 1.6.4
0.2.3 0.10.2 1.6.4
0.2.4 0.10.2 1.6.4
0.2.5 0.13.1 1.7.0
0.2.6 0.13.1 1.7.0
0.3.0 1.2.1 1.7.1
0.3.1 1.3.1 1.9.2
0.3.2 1.3.1 1.9.3
0.3.3-SNAPSHOT 1.3.1 1.9.3

Using not matching versions may cause runtime exceptions.

FreeType and Box2d

If you want to use FreeType fonts you must add FreeType libGDX extension. If you want to use Box2d physics you must add Box2d libGDX extension.

Spine Runtime Setup

Unfortunately due to Spine license, the Vis Spine Runtime cannot be distributed as Gradle dependency. This dependency must be added as JAR dependency.

  1. Navigate to VisEditor installation directory then plugins/spine/lib
  2. Copy vis-runtime-spine.jar to the directory Gradle project root/libs (create libs folder)
  3. Alter your build.gradle script in the root directory as follows:
  • Locate the :core stub where the core project's dependencies are declared
  • Add the line in dependencies
compile fileTree(dir: '../libs', include: '*.jar')
  • Your script should now look a little like this:
project(":core") {
  ...

   dependencies {
       ...
       compile fileTree(dir: '../libs', include: '*.jar')
   }
}
  • Locate the :android stub and add the same dependency again:
project(":android") {
  ...

   dependencies {
       ...
       compile fileTree(dir: '../libs', include: '*.jar')
   }
}

Refresh your Gradle project dependencies, either on command line or from IDE.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.