<tfoot id='m66YK'></tfoot>

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

        • <bdo id='m66YK'></bdo><ul id='m66YK'></ul>
      2. <small id='m66YK'></small><noframes id='m66YK'>

        <legend id='m66YK'><style id='m66YK'><dir id='m66YK'><q id='m66YK'></q></dir></style></legend>

        libgdx - 如何在舞台上添加背景图片?

        时间:2023-05-19
              • <bdo id='o0bpe'></bdo><ul id='o0bpe'></ul>
              • <tfoot id='o0bpe'></tfoot>

                  <legend id='o0bpe'><style id='o0bpe'><dir id='o0bpe'><q id='o0bpe'></q></dir></style></legend>

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

                    <tbody id='o0bpe'></tbody>
                  <i id='o0bpe'><tr id='o0bpe'><dt id='o0bpe'><q id='o0bpe'><span id='o0bpe'><b id='o0bpe'><form id='o0bpe'><ins id='o0bpe'></ins><ul id='o0bpe'></ul><sub id='o0bpe'></sub></form><legend id='o0bpe'></legend><bdo id='o0bpe'><pre id='o0bpe'><center id='o0bpe'></center></pre></bdo></b><th id='o0bpe'></th></span></q></dt></tr></i><div id='o0bpe'><tfoot id='o0bpe'></tfoot><dl id='o0bpe'><fieldset id='o0bpe'></fieldset></dl></div>
                  本文介绍了libgdx - 如何在舞台上添加背景图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我正在学习 libgdx,但我被困在一个点上..

                  I am learning libgdx but i am stuck at a point..

                  我在我的舞台上添加了一个按钮,现在我想在舞台上添加一个图像,以便图像看起来像按钮的背景图像.我的意思是说按钮应该位于图像上.我一直在寻找教程,但无法做到这一点.

                  I have added a button in my stage , now i want to add a image in the stage so that the image looks as the background image to the button.i mean to say that the button should lie on the image. I have been looking tutorials but not been able to do that.

                  怎么做?有什么帮助吗?

                  How can it be done? any help?

                  推荐答案

                  您唯一需要做的就是在绘制Button之前绘制背景.
                  有几种可能的方法来做到这一点:
                  - 您可以将背景作为 Image(Actor 的子类)添加到 Stage 并使用 z-index 确保它被绘制为背景.
                  - 您可以获取 Stage 的 SpriteBatch (stage.getBatch()) 并使用其中一种 draw 方法在调用 stage.draw()

                  The only thing you need to do is to draw the background, before drawing the Buttons.
                  There are a few possible ways to do that:
                  - You can add the background as an Image (subclass of Actor) to the Stage and use the z-index to make sure it is drawn as a background.
                  - You can get the Stages SpriteBatch (stage.getBatch()) and use one of its draw methods to draw the background, before calling stage.draw()

                  您也可以使用另一个 SpriteBatch,但我不推荐它,因为它是一个非常重"的对象,在这种情况下它不是必需的.
                  我猜,在调用 stage.draw() 之前,你需要调用 spritebatch.end(),因为你习惯于 的 SpriteBatch绘制背景.

                  You could also use another SpriteBatch, but i don't recommend it, as it is a pretty "heavy" object and it is just not neccessaty in this case.
                  I guess, before calling stage.draw() you need to call spritebatch.end(), for the SpriteBatch you used to draw the background.

                  这篇关于libgdx - 如何在舞台上添加背景图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何更改 libgdx 不同的窗口大小? 下一篇:如何解决 Gradle 插件依赖?

                  相关文章

                  最新文章

                  <legend id='cEqcO'><style id='cEqcO'><dir id='cEqcO'><q id='cEqcO'></q></dir></style></legend>

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

                  <tfoot id='cEqcO'></tfoot>

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