Learning LibGDX.
Following GamesDevelopment.blog’s tuorial to the letter.
Downloaded the free skins from github
- placed a copy of glassy-ui/skins folder into project/android/assets
- Hit Refresh Project
- AIDE does some stuff
- run project
- installs okay but crashes on startup
- BIG Logcat error:
FATAL EXCEPTION: GLThread 12682
04-26 12:59:22.290 12379 12457 E AndroidRuntime >Process: com.suchuu.box2dtutorial, PID: 12379
04-26 12:59:22.290 12379 12457 E AndroidRuntime >com.badlogic.gdx.utils.SerializationException: Error reading file: skin/glassy-ui.json
04-26 12:59:22.290 12379 12457 E AndroidRuntime at >com.badlogic.gdx.scenes.scene2d.ui.Skin.load(Skin.java:96)
04-26 12:59:22.290 12379 12457 E AndroidRuntime at com.badlogic.gdx.scenes.scene2d.ui.Skin.(Skin.java:73)
04-26 12:59:22.290 12379 12457 E AndroidRuntime at >com.suchuu.box2dtutorial.views.MenuScreen.show(MenuScreen.java:28)
04-26 12:59:22.290 12379 12457 E AndroidRuntime at com.badlogic.gdx.Game.setScreen(Game.java:61)
04-26 12:59:22.290 12379 12457 E AndroidRuntime at >com.suchuu.box2dtutorial.Box2DTutorial.changeScreen(Box2DTutorial.java:35)
04-26 12:59:22.290 12379 12457 E AndroidRuntime at >com.suchuu.box2dtutorial.views.LoadingScreen.render(LoadingScreen.java:26)
04-26 12:59:22.290 12379 12457 E AndroidRuntime at com.badlogic.gdx.Game.render(Game.java:46)
04-26 12:59:22.290 12379 12457 E AndroidRuntime at >com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:414)
04-26 12:59:22.290 12379 12457 E AndroidRuntime at >android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1571)
04-26 12:59:22.290 12379 12457 E AndroidRuntime at >android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1270)
04-26 12:59:22.290 12379 12457 E AndroidRuntime Caused by: >com.badlogic.gdx.utils.SerializationException: Error reading file: skin/glassy-ui.json
04-26 12:59:22.290 12379 12457 E AndroidRuntime at >com.badlogic.gdx.utils.Json.fromJson(Json.java:662)
04-26 12:59:22.290 12379 12457 E AndroidRuntime at >com.badlogic.gdx.scenes.scene2d.ui.Skin.load(Skin.java:94)
04-26 12:59:22.290 12379 12457 E AndroidRuntime … 9 more
04-26 12:59:22.290 12379 12457 E AndroidRuntime Caused by: >com.badlogic.gdx.utils.SerializationException: Error parsing file: skin/glassy-ui.json
04-26 12:59:22.290 12379 12457 E AndroidRuntime at >com.badlogic.gdx.utils.JsonReader.parse(JsonReader.java:77)
04-26 12:59:22.290 12379 12457 E AndroidRuntime at >com.badlogic.gdx.utils.Json.fromJson(Json.java:660)
04-26 12:59:22.290 12379 12457 E AndroidRuntime >… 10 more
04-26 12:59:22.290 12379 12457 E AndroidRuntime Caused by: >com.badlogic.gdx.utils.SerializationException: Error parsing JSON on line 6 near: font-big: {
04-26 12:59:22.290 12379 12457 E AndroidRuntime file: font-big-export.fnt
04-26 12:59:22.290 12379 12457 E AndroidRuntime }
04-26 12:59:22.290 12379 12457 E AndroidRuntime }
04-26 12:59:22.290 12379 12457 E AndroidRuntime com.badlogic.gdx.graphics.Color: {
04-26 12:59:22.290 12379 12457 E AndroidRuntime black: {
04-26 12:59:22.290 12379 12457 E AndroidRuntime r: 0
04-26 12:59:22.290 12379 12457 E AndroidRuntime g: 0
04-26 12:59:22.290 12379 12457 E AndroidRuntime b: 0
04-26 12:59:22.290 12379 12457 E AndroidRuntime a: 1
04-26 12:59:22.290 12379 12457 E AndroidRuntime }
04-26 12:59:22.290 12379 12457 E AndroidRuntime cyan: {
04-26 12:59:22.290 12379 12457 E AndroidRuntime r: 0
04-26 12:59:22.290 12379 12457 E AndroidRuntime g: 1
04-26 12:59:22.290 12379 12457 E AndroidRuntime b: 0.99166656
04-26 12:59:22.290 12379 12457 E AndroidRuntime a: 1
04-26 12:59:22.290 12379 12457 E AndroidRuntime }
04-26 12:59:22.290 12379 12457 E AndroidRuntime dark-cyan: {
04-26 12:59:22.290 12379 12457 E AndroidRuntime r: 0
04-26 12:59:22.290 12379 12457 E AndroidRuntime g: 0.39373153
04-26 12:59:22.290 12379 12457 E AndroidRuntime b: 0.4333333
04-26 12:59:22.290 12379 12457 E AndroidRuntime a: 1
04-26 12:59:22.290 12379 12457 E AndroidRuntime }
04-26 12:59:22.290 12379 12457 E AndroidRuntime white: {
04-26 12:59:22.290 12379 12457 E AndroidRuntime r: 1
04-26 12:59:22.290 12379 12457 E AndroidRuntime g: 1
04-26 12:59:22.290 12379 12457 E AndroidRuntime b: 1
04-26 12:59:22.290 12379 12457 E AndroidRuntime a: 1
04-26 12:59:22.290 12379 12457 E AndroidRuntime }
04-26 12:59:22.290 12379 12457 E AndroidRuntime }
04-26 12:59:22.290 12379 12457 E AndroidRuntime >com.badlogic.gdx.scenes.scene2d.ui.Skin$TintedDrawable: {
04-26 12:59:22.290 12379 12457 E AndroidRuntime >pale-blue: {
04-26 12:59:22.290 12379 12457 E AndroidRuntime >name: white
04-26 12:59:22.290 12379 12457 E AndroidRuntime >color: {
04-26 12:59:22.290 12379 12457 E AndroidRuntime >r: 0.48342222
04-26 12:59:22.290 12379 12457 E AndroidRuntime >g: 0.76367503
04-26 12:59:22.290 12379 12457 E AndroidRuntime >b: 0.99333334
… And loads more
So, I’m not sure what’s going on.
AIDE can obviously see glassy-ui.json but it’s having trouble knowing what to do with it.
Code…
public class MenuScreen implements Screen
{
private Box2DTutorial game;
private Stage stage;
public MenuScreen(Box2DTutorial game) {
super();
this.game = game;
stage = new Stage(new ScreenViewport());
Gdx.input.setInputProcessor(stage);
}
@Override
public void show() {
Table table = new Table();
table.setFillParent(true);
table.setDebug(true);
stage.addActor(table);
// Heres the problem
Skin skin = new Skin(Gdx.files.internal("skin/glassy-ui.json"));
TextButton newGameBtn = new TextButton("New Game", skin);
TextButton preferencesBtn = new TextButton("Preferences", skin);
TextButton exitBtn = new TextButton("Exit", skin);
table.add(newGameBtn).fillX().uniformX();
table.row().pad(10, 0, 10, 0);
table.add(preferencesBtn).fillX().uniformX();
table.row();
table.add(exitBtn).fillX().uniformX();
}
@Override
public void render(float delta) {
stage.act(Math.min(Gdx.graphics.getDeltaTime(), 1 /30f));
stage.draw();
}
@Override
public void resize(int width, int height) {}
@Override
public void pause() {}
@Override
public void resume() {}
@Override
public void hide() {}
@Override
public void dispose() {
stage.dispose();
}
}