Libgdx - Making a drop-down menu/settings screen

懵懂的女人 提交于 2019-12-11 02:48:21

问题


I'm looking to make a drop-down menu and drop-down settings screen but I couldn't find any resources for making these in Libgdx. Would like some pointers to good resources for this specific type of interface or a quick example.

Thanks!


回答1:


SelectBox is in LibGDX can be used for drop-down list, it allows one of a number of values to be chosen from a list. And for pop-up window you can use Dialog.

stage=new Stage();

Skin skin=new Skin(Gdx.files.internal("skin/glassy-ui.json"));

dialog=new Dialog("Setting",skin);
dialog.setSize(200,200);
dialog.setPosition(Gdx.graphics.getWidth()/2-100,Gdx.graphics.getHeight()/2-100);

final SelectBox<String> selectBox=new SelectBox<String>(skin);
selectBox.setItems("XYZ","ABC","PQR","LMN");

dialog.getContentTable().defaults().pad(10);
dialog.getContentTable().add(selectBox);

stage.addActor(dialog);
Gdx.input.setInputProcessor(stage);

Output



来源:https://stackoverflow.com/questions/44228190/libgdx-making-a-drop-down-menu-settings-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!