|
@@ -232,16 +232,18 @@ public class SkeletonViewer extends ApplicationAdapter {
|
|
|
ui.stage.draw();
|
|
|
|
|
|
// Draw indicator for timeline position.
|
|
|
- ShapeRenderer shapes = debugRenderer.getShapeRenderer();
|
|
|
- TrackEntry entry = state.getCurrent(0);
|
|
|
- if (entry != null) {
|
|
|
- float percent = entry.getTime() / entry.getEndTime();
|
|
|
- if (entry.getLoop()) percent %= 1;
|
|
|
- float x = ui.window.getRight() + (Gdx.graphics.getWidth() - ui.window.getRight()) * percent;
|
|
|
- shapes.setColor(Color.CYAN);
|
|
|
- shapes.begin(ShapeType.Line);
|
|
|
- shapes.line(x, 0, x, 20);
|
|
|
- shapes.end();
|
|
|
+ if (state != null) {
|
|
|
+ ShapeRenderer shapes = debugRenderer.getShapeRenderer();
|
|
|
+ TrackEntry entry = state.getCurrent(0);
|
|
|
+ if (entry != null) {
|
|
|
+ float percent = entry.getTime() / entry.getEndTime();
|
|
|
+ if (entry.getLoop()) percent %= 1;
|
|
|
+ float x = ui.window.getRight() + (Gdx.graphics.getWidth() - ui.window.getRight()) * percent;
|
|
|
+ shapes.setColor(Color.CYAN);
|
|
|
+ shapes.begin(ShapeType.Line);
|
|
|
+ shapes.line(x, 0, x, 20);
|
|
|
+ shapes.end();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|