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

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

        <bdo id='dak4M'></bdo><ul id='dak4M'></ul>
    2. <legend id='dak4M'><style id='dak4M'><dir id='dak4M'><q id='dak4M'></q></dir></style></legend>

      Libgdx 相机/缩放问题

      时间:2023-05-20
              <tfoot id='5uWT7'></tfoot>

                <tbody id='5uWT7'></tbody>

              <small id='5uWT7'></small><noframes id='5uWT7'>

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

              • 本文介绍了Libgdx 相机/缩放问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                这只是一个非常快速的帖子,想知道我做错了什么?

                This is just a really quick post wondering what i have done wrong?

                我希望使用我拥有的任何屏幕尺寸在整个屏幕上填充背景,但这并不能使它起作用.这里是所有代码:

                I want the background to be filled on the whole screen with whatever screen sizes i have but this does not make it work. Here is all the code:

                // Variables
                
                Jump game;
                
                OrthographicCamera cam;
                
                SpriteBatch sb;
                
                 // Variables
                
                public SplashScreen(Jump game)
                {
                    this.game = game;
                
                    cam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
                
                    cam.translate(cam.viewportWidth / 2, cam.viewportHeight / 2);
                
                    sb = new SpriteBatch();
                }
                
                public void show() 
                {
                
                }
                
                public void render(float delta) 
                {
                    Gdx.gl20.glClearColor(0.2F, 0.6F, 1F, 1F);
                
                    Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT);
                
                    cam.update();
                
                    sb.begin();
                
                    sb.setProjectionMatrix(cam.combined);
                
                    sb.draw(Assets.splash_spr_background, 0, 0);
                
                    sb.end();
                
                }
                

                谢谢!:)

                推荐答案

                问题是您的资产与视口大小不同.请参阅下面的链接.Libgdx 使用 Viewport 类来处理这个问题.

                The problem is your asset is not the same size as the viewport. See the links below. Libgdx uses the Viewport class to handle this.

                如何处理libGDX中不同的纵横比?

                如何根据不同缩放图片libgdx 中的屏幕分辨率

                https://github.com/libgdx/libgdx/wiki/Viewports

                这篇关于Libgdx 相机/缩放问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:Libgdx:音轨循环滞后 下一篇:如何让玩家通过相机被摧毁?

                相关文章

                最新文章

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

                • <bdo id='joHhc'></bdo><ul id='joHhc'></ul>

                1. <legend id='joHhc'><style id='joHhc'><dir id='joHhc'><q id='joHhc'></q></dir></style></legend>
                  <tfoot id='joHhc'></tfoot>
                  <i id='joHhc'><tr id='joHhc'><dt id='joHhc'><q id='joHhc'><span id='joHhc'><b id='joHhc'><form id='joHhc'><ins id='joHhc'></ins><ul id='joHhc'></ul><sub id='joHhc'></sub></form><legend id='joHhc'></legend><bdo id='joHhc'><pre id='joHhc'><center id='joHhc'></center></pre></bdo></b><th id='joHhc'></th></span></q></dt></tr></i><div id='joHhc'><tfoot id='joHhc'></tfoot><dl id='joHhc'><fieldset id='joHhc'></fieldset></dl></div>