-1
當我在IntelliJ上運行這個LibGdx代碼時,使用DesktopLaucher很好。 但是,當我通過USB運行它到我的Android應用程序崩潰。執行代碼時我的Android崩潰
public class GraphicInterface extends ApplicationAdapter {
private Stage Graphs;
Camera screen = new OrthographicCamera();
public Skin skin;
@Override
public void create() {
skin = new Skin(Gdx.files.internal("uiskin.json"));
Graphs = new Stage(new ScreenViewport());
final TextButton button1 = new TextButton("Click me", skin,"default");
button1.setWidth(200f);
button1.setHeight(50f);
final Dialog texto = new Dialog("Click Message", skin);
button1.addListener(new ClickListener(){
@Override
public void clicked(InputEvent event, float x, float y){
texto.show(Graphs);
Timer.schedule(new Timer.Task(){
@Override
public void run() {
texto.hide();
}
},5);
}
});
Graphs.addActor(button1);
Gdx.input.setInputProcessor(Graphs);
}
@Override
public void render() {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
Graphs.act(Gdx.graphics.getDeltaTime());
Graphs.draw();
}
}
我也有一個JSON文件中加入:
{
com.badlogic.gdx.graphics.g2d.BitmapFont: {
default-font: {
file: Razer.fnt
}
},
com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
default: {
down: default-round-down,
up: default-round,
font: default-font
},
},
com.badlogic.gdx.scenes.scene2d.ui.Window$WindowStyle: {
default: {
titleFont: default-font
}
}
}
我把那最後部分來自Libgdx(GitHub的`我think')和教程
你能發佈崩潰細節嗎? – TheoKanning
這不是JSON ... –
要查看JSON是否有效,請使用[JSONLint](http://jsonlint.com/),您將看到此JSON不正確。 –