java - Menu with table layout in LibGDX won't load -
i'm using table layout option menu in game.
when launch screen there's black screen. see :
package com.me.mygdxgame; import com.badlogic.gdx.gdx; import com.badlogic.gdx.screen; import com.badlogic.gdx.files.filehandle; import com.badlogic.gdx.graphics.gl20; import com.badlogic.gdx.scenes.scene2d.actor; import com.badlogic.gdx.scenes.scene2d.stage; import com.badlogic.gdx.scenes.scene2d.ui.checkbox; import com.badlogic.gdx.scenes.scene2d.ui.label; import com.badlogic.gdx.scenes.scene2d.ui.skin; import com.badlogic.gdx.scenes.scene2d.ui.table; import com.badlogic.gdx.scenes.scene2d.utils.changelistener; import com.badlogic.gdx.scenes.scene2d.utils.clicklistener; public class bluetoothoptionscreen implements screen{ final stage stage; skin skin; boolean hote = false; table table; public bluetoothoptionscreen() { system.out.println("option screen, commencement de l'initialisation"); this.stage = new stage(gdx.graphics.getwidth(), gdx.graphics.getwidth(), true); filehandle skinfile1 = gdx.files.internal("uiskin.json"); skin = new skin(skinfile1); } @override public void render(float delta) { stage.act(delta); gdx.gl.glclear( gl20.gl_color_buffer_bit ); stage.draw(); table.drawdebug(stage); } @override public void resize(int width, int height) { stage.setviewport(width, height, true); } @override public void show() { gdx.input.setinputprocessor( stage ); table = new table(skin); stage.addactor(table); table.setfillparent(true); table.defaults().spacebottom(30); table.add("options").colspan(3); final checkbox hotecheckbox = new checkbox( "", skin ); hotecheckbox.setchecked(true); hotecheckbox.addlistener(new changelistener() { @override public void changed( changeevent event, actor actor ) { boolean enabled = hotecheckbox.ischecked(); hote = enabled; } } ); table.row(); table.add("hote"); table.add(hotecheckbox); system.out.println("prout"); } }
i glad if can me out. if need else understand problem, ask me.
your problem possibly lies skin.
try replacing table image, if works, problem skin. in case, consider using correct (tested) skin libgdx tests.
make sure have 5 files (at least) uiskin.json, uiskin.atlas, uiskin.png, default.fnt, default.png (last 2 correspond font).
good luck.
Comments
Post a Comment