1. <legend id='3fdjI'><style id='3fdjI'><dir id='3fdjI'><q id='3fdjI'></q></dir></style></legend>

      <i id='3fdjI'><tr id='3fdjI'><dt id='3fdjI'><q id='3fdjI'><span id='3fdjI'><b id='3fdjI'><form id='3fdjI'><ins id='3fdjI'></ins><ul id='3fdjI'></ul><sub id='3fdjI'></sub></form><legend id='3fdjI'></legend><bdo id='3fdjI'><pre id='3fdjI'><center id='3fdjI'></center></pre></bdo></b><th id='3fdjI'></th></span></q></dt></tr></i><div id='3fdjI'><tfoot id='3fdjI'></tfoot><dl id='3fdjI'><fieldset id='3fdjI'></fieldset></dl></div>
      • <bdo id='3fdjI'></bdo><ul id='3fdjI'></ul>
      <tfoot id='3fdjI'></tfoot>

      <small id='3fdjI'></small><noframes id='3fdjI'>

        LibGDX 中的分屏

        时间:2023-05-19
            <bdo id='VFm8k'></bdo><ul id='VFm8k'></ul>

            <small id='VFm8k'></small><noframes id='VFm8k'>

              <tbody id='VFm8k'></tbody>
            • <tfoot id='VFm8k'></tfoot><legend id='VFm8k'><style id='VFm8k'><dir id='VFm8k'><q id='VFm8k'></q></dir></style></legend>
                • <i id='VFm8k'><tr id='VFm8k'><dt id='VFm8k'><q id='VFm8k'><span id='VFm8k'><b id='VFm8k'><form id='VFm8k'><ins id='VFm8k'></ins><ul id='VFm8k'></ul><sub id='VFm8k'></sub></form><legend id='VFm8k'></legend><bdo id='VFm8k'><pre id='VFm8k'><center id='VFm8k'></center></pre></bdo></b><th id='VFm8k'></th></span></q></dt></tr></i><div id='VFm8k'><tfoot id='VFm8k'></tfoot><dl id='VFm8k'><fieldset id='VFm8k'></fieldset></dl></div>
                  本文介绍了LibGDX 中的分屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  这个问题很简短.如何在 LibGDX 中创建分屏效果.如果我创建两个相机,它会做的就是在某处绘制一个,然后绘制下一个,覆盖前一个相机.然后我想使用多个屏幕,但这看起来并不可行,因为它只支持调整大小而不支持在窗口内重新定位.我还使用 Box2DDebugRenderer 和 ShapeRenderer,因此它还需要在分屏限制处切断它们.LibGDX 站点上似乎没有任何文档.

                  This question is short and simple. How do I create a split screen effect in LibGDX. If I create two cameras all it will do is draw one located somewhere and then draw the next, overwriting the previous camera. I then thought to use multiple screens but that doesn't look like it will work as it only supports resizing and not relocating within the window. I'm also using Box2DDebugRenderer as well as a ShapeRenderer so it would also need to cut those off at the split-screen limit. There doesn't seem to be any documentation on the LibGDX site.

                  推荐答案

                  在#libgdx IRC上询问了一下,函数Gdx.gl.glViewport( int x, int y, int width, int height) 向我指出.所以你只需要一台相机.只需设置屏幕左侧的视口,然后执行绘图命令,然后设置屏幕右侧的视口并再次绘制.像这样:

                  After asking around a bit on the #libgdx IRC, the function Gdx.gl.glViewport( int x, int y, int width, int height ) was pointed out to me. So you only need one camera. Just set the viewport for the left side of the screen then perform your drawing commands, then set up the viewport for the right side of the screen and draw again. like so:

                  @Override
                  public void render( float delta )
                  {
                      /*Wipe Screen to black*/
                      Gdx.gl.glClearColor( Color.BLACK );
                      Gdx.gl.glClear( GL10.GL_COLOR_BUFFER_BIT );
                  
                      /*Left Half*/
                      Gdx.gl.glViewport( 0,0,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight() );
                      //Set up camera with viewport in mind
                      draw( delta );
                  
                      /*Right Half*/
                      Gdx.gl.glViewport( Gdx.graphics.getWidth()/2,0,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight() );
                      //Set up camera again with other viewport in mind
                      draw( delta );
                  }
                  

                  您只需要设置相机,使其以您想要的方式定位和转换到有限的屏幕,而不是整个屏幕.您还可以使用第二个摄像头.

                  You just need to set up the camera so that it is being positioned and transformed to the limited screen the way you want instead of the whole screen. You could potentially also use a 2nd camera.

                  这篇关于LibGDX 中的分屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:某些设备的 LibGdx-ViewPort 宽度和高度不匹配 下一篇:了解 libgdx

                  相关文章

                  最新文章

                • <legend id='7Pvki'><style id='7Pvki'><dir id='7Pvki'><q id='7Pvki'></q></dir></style></legend>

                • <i id='7Pvki'><tr id='7Pvki'><dt id='7Pvki'><q id='7Pvki'><span id='7Pvki'><b id='7Pvki'><form id='7Pvki'><ins id='7Pvki'></ins><ul id='7Pvki'></ul><sub id='7Pvki'></sub></form><legend id='7Pvki'></legend><bdo id='7Pvki'><pre id='7Pvki'><center id='7Pvki'></center></pre></bdo></b><th id='7Pvki'></th></span></q></dt></tr></i><div id='7Pvki'><tfoot id='7Pvki'></tfoot><dl id='7Pvki'><fieldset id='7Pvki'></fieldset></dl></div>

                  1. <tfoot id='7Pvki'></tfoot>
                      <bdo id='7Pvki'></bdo><ul id='7Pvki'></ul>

                    1. <small id='7Pvki'></small><noframes id='7Pvki'>