Lamellama

Hi, I am having a problem loading my animation into libgdx.

When I run as a Java application I receive an error relating to the line:
skeleton.drawDebug(renderer);
If I comment this line out, the animation loads. What does drawDebug do? and why is it failing?

Error:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NoSuchFieldError: Filled
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:113)
Caused by: java.lang.NoSuchFieldError: Filled
at com.esotericsoftware.spine.Skeleton.drawDebug(Skeleton.java:142)
at book.Game.render(Game.java:71)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:187)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:110)

Source:
package book;

import com.esotericsoftware.spine.Animation;
import com.esotericsoftware.spine.Bone;
import com.esotericsoftware.spine.Skeleton;
import com.esotericsoftware.spine.SkeletonData;
import com.esotericsoftware.spine.SkeletonJson;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;

import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;

public class Game implements ApplicationListener {
SpriteBatch batch;
ShapeRenderer renderer;

TextureAtlas atlas;
Skeleton skeleton;
Animation animation;
float time;
Bone root;

@Override
public void create() {
batch = new SpriteBatch();
renderer = new ShapeRenderer();

atlas = new TextureAtlas(Gdx.files.internal("frog/frog.atlas"));
SkeletonJson json = new SkeletonJson(atlas);
SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("frog/skeleton.json"));
//animation = json.readAnimation(Gdx.files.internal("spineboy/spineboy-walk.json"), skeletonData);
animation = skeletonData.findAnimation("breathing");
skeleton = new Skeleton(skeletonData);

root = skeleton.getRootBone();
root.setX(10);
root.setY(20);

skeleton.updateWorldTransform();

}

@Override
public void resize(int width, int height) {
batch.getProjectionMatrix().setToOrtho2D(0, 0, width, height);
renderer.setProjectionMatrix(batch.getProjectionMatrix());

}

float totalTime = 0f;
@Override
public void render() {

float delta = Gdx.graphics.getDeltaTime() / 3;
time += delta;

Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
batch.begin();

animation.apply(skeleton, time, true);
root.setX(root.getX() + 230 * delta);
skeleton.updateWorldTransform();
skeleton.draw(batch);

batch.end();

skeleton.drawDebug(renderer);

}

@Override
public void pause() {
// TODO Auto-generated method stub

}

@Override
public void resume() {
// TODO Auto-generated method stub

}

@Override
public void dispose() {
atlas.dispose();

}

}
Lamellama
  • Сообщения: 9

Nate

Use libgdx nightlies.
Аватара пользователя
Nate

Nate
  • Сообщения: 9853

Lamellama

Doh, thanks.

I hadn't updated the gdx-backend-lwjgl jars

So drawDebug draws with the bones
Lamellama
  • Сообщения: 9


Вернуться в Editor