本文整理了Java中com.badlogic.gdx.scenes.scene2d.Stage.setViewport()
方法的一些代码示例,展示了Stage.setViewport()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Stage.setViewport()
方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.Stage
类名称:Stage
方法名:setViewport
暂无
代码示例来源:origin: stackoverflow.com
ui.setViewport(width, height, true);
Log.d("Resize: "+width+", "+height);
代码示例来源:origin: libgdx/libgdx
public void create () {
stage = new Stage();
Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));
label = new Label("", skin);
Table root = new Table(skin);
root.setFillParent(true);
root.setBackground(skin.getDrawable("default-pane"));
root.debug().defaults().space(6);
root.add(new TextButton("Button 1", skin));
root.add(new TextButton("Button 2", skin)).row();
root.add("Press spacebar to change the viewport:").colspan(2).row();
root.add(label).colspan(2);
stage.addActor(root);
viewports = getViewports(stage.getCamera());
names = getViewportNames();
stage.setViewport(viewports.first());
label.setText(names.first());
Gdx.input.setInputProcessor(new InputMultiplexer(new InputAdapter() {
public boolean keyDown (int keycode) {
if (keycode == Input.Keys.SPACE) {
int index = (viewports.indexOf(stage.getViewport(), true) + 1) % viewports.size;
label.setText(names.get(index));
Viewport viewport = viewports.get(index);
stage.setViewport(viewport);
resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
}
return false;
}
}, stage));
}
代码示例来源:origin: SquidPony/SquidLib
public ShrinkPartViewport resizeInnerStage(Stage insides)
{
if(!initialized)
return null;
/*
insides.getViewport().setWorldWidth(insides.getViewport().getWorldWidth() - screenWidth * 2);
insides.getViewport().setScreenX(screenWidth);
insides.getViewport().setScreenY(0);
*/
spv = new ShrinkPartViewport(insides.getWidth(), insides.getHeight(), sectionWidth);
insides.setViewport(spv);
return spv;
}
内容来源于网络,如有侵权,请联系作者删除!