libgdx 如何将屏幕分成 4 个部分
libgdx how to split the screen to 4 parts
我希望我的屏幕看起来像这样:
在左上角我需要有 6 3d models
所以我将使用 PerspectiveCamera
来做到这一点。右上角的笑话需要显示一些数据,因此我将使用 scene2d
来实现。左下角需要一个组合,当 3d models
将被 batch.dra()
和 PerspectiveCamera
淹没时,关于模型的数据将是 scene2d
。在右下角我开玩笑地需要一个 scene2d
table
来显示所有连接的用户。我的问题是如何将我的屏幕分成 4 个,这样屏幕的每个部分都会以不同的方式呈现。
您可以尝试 offsetting the viewport 与 setScreenX
、setScreenY
和 screenBounds
。您现在确实需要使用 2 个视口。
否则可以直接改变视口。 Gdx.gl.glViewport( 0,Gdx.graphics.getHeight() / 2,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight() / 2 );
应该在上角绘制所有内容。在更新中它看起来像这样:
`Gdx.gl.glViewport( 0,Gdx.graphics.getHeight() / 2,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight() / 2 );
//Draw upper right window stuff
Gdx.gl.glViewport( 0,0, Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
//Draw your stage and just leave the upper right window/table cell transparent
我没有测试任何一种解决方案,所以我不确定它是否适合你。
我希望我的屏幕看起来像这样:
3d models
所以我将使用 PerspectiveCamera
来做到这一点。右上角的笑话需要显示一些数据,因此我将使用 scene2d
来实现。左下角需要一个组合,当 3d models
将被 batch.dra()
和 PerspectiveCamera
淹没时,关于模型的数据将是 scene2d
。在右下角我开玩笑地需要一个 scene2d
table
来显示所有连接的用户。我的问题是如何将我的屏幕分成 4 个,这样屏幕的每个部分都会以不同的方式呈现。
您可以尝试 offsetting the viewport 与 setScreenX
、setScreenY
和 screenBounds
。您现在确实需要使用 2 个视口。
否则可以直接改变视口。 Gdx.gl.glViewport( 0,Gdx.graphics.getHeight() / 2,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight() / 2 );
应该在上角绘制所有内容。在更新中它看起来像这样:
`Gdx.gl.glViewport( 0,Gdx.graphics.getHeight() / 2,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight() / 2 );
//Draw upper right window stuff
Gdx.gl.glViewport( 0,0, Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
//Draw your stage and just leave the upper right window/table cell transparent
我没有测试任何一种解决方案,所以我不确定它是否适合你。