Scrollable html list in libgdx

雨燕双飞 提交于 2019-12-08 09:06:49

问题


I want to make achievements table in my libgdx game. Is there any component in libgdx wchih i can use? For example something that allows me to turn screen into html page or something like this.


回答1:


simple test for you start:

Variable Class:

Stage stage;
ScrollPane scrollPane;
Table outerTable, innerTable;

.

@Override
public void show() {

    stage      = new Stage();
    outerTable = new Table();
    innerTable = new Table();
    image      = new Image(new Texture(
                           Gdx.files.internal("badlogic.jpg")));

    //innerTable.add(YourActor); for example Image, or TextButton 

    innerTable.add(image);

    scrollPane = new ScrollPane(innerTable); 

    outerTable.setPosition(0, 0);
    outerTable.setSize(Gdx.graphics.getWidth(),Gdx.graphics.getHeight());

    outerTable.debug();

    outerTable.add(scrollPane).fill().expand();

    stage.addActor(outerTable);
}

@Override
public void render(float delta) {
    Gdx.gl20.glClearColor(0, 0, 0, 1);
    Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT);

    stage.act(delta);
    stage.draw();
}

look this: https://github.com/libgdx/libgdx/wiki/Table

I hope I have understood correctly, and that this is what you want.



来源:https://stackoverflow.com/questions/28592083/scrollable-html-list-in-libgdx

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