<bdo id='CvL5t'></bdo><ul id='CvL5t'></ul>

  • <tfoot id='CvL5t'></tfoot>

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

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

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

        libgdx 剪切图像

        时间:2023-05-20
          <tbody id='nG26U'></tbody>

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

              <tfoot id='nG26U'></tfoot>
            • <legend id='nG26U'><style id='nG26U'><dir id='nG26U'><q id='nG26U'></q></dir></style></legend>

              1. <small id='nG26U'></small><noframes id='nG26U'>

                • <bdo id='nG26U'></bdo><ul id='nG26U'></ul>
                  本文介绍了libgdx 剪切图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  一段时间以来,我一直在尝试剪切"图像,我将解释为什么以及我尝试了什么.所以我想创建一个 hp条",除了它不是条而是一颗心,所以我虽然很容易,但我所要做的就是让两张图片将它们相互叠加,然后剪下一张来制作它显示为 hp 正在丢失,但我无法找到剪切图像的方法.

                  I have been trying to "cut" an image for some time now, I ll explain why and what I tried. So I wanted to create an hp "bar" except it's not a bar but a heart and so I though it would be easy all I had to do is have two pictures draw them on top of each other and then just cut one to make it appear as in hp was being lost, but I was not able to find a way to cut the image.

                  • 设置高度只是调整图像的大小,您可能已经猜到了
                  • 我尝试使用 textureRegion 来破解它,但效果不佳
                  • 我发现了一种名为 clip begin 的方法,它也使用剪刀,但由于某种原因,它似乎不起作用.

                  我可能使用的剪辑开始错误,但我真的找不到任何真正的文档,我正在做的只是:

                  I might be using the clip begin wrong but I can't really find any real documentation on it, all I'm doing is:

                  image.clipBegin(x,y,height,weight);
                  image.clipEnd();
                  

                  我差点忘了,我使用的是 scene2d 图像,可能是更好的解决方法,但不确定会是什么.

                  I almost forgot, I'm using a scene2d Image, might be a better way to go around it but not sure what that would be.

                  如果有任何关于如何做到这一点的想法,我将不胜感激,谢谢.

                  I would appreciate any ideas on how to do this, thank you.

                  推荐答案

                  您想使用 Libgdx 公开的 OpenGL Scissor 支持.请参阅 Libgdx Clipping wiki和 Libgdx ScissorStack 文档.

                  You want to use the OpenGL Scissor support that Libgdx exposes. See the Libgdx Clipping wiki and the Libgdx ScissorStack documentation.

                  API 不是特别友好(它旨在支持动态推送多个约束矩形,据我所知,它并不经常使用).

                  The API isn't particularly friendly (its designed to support dynamically pushing multiple constraining rectangles, which as far as I've seen, isn't used very often).

                  使用剪刀堆栈要记住的重要一点是,它仅适用于发出的实际绘图命令.由于大多数 API 尝试批量绘制命令,这意味着实际绘制可能不会在看起来应该发生的时候发生.为确保发生剪裁,您必须在推动剪刀之前刷新所有缓冲的绘图(否则可能会剪裁错误的东西),并且您必须在弹出剪刀之前冲洗任何绘制调用(否则您想要剪裁的东西可能会避开剪刀).

                  The important point to remember with the scissor stack is that it only applies to actual draw commands that get issued. Since most APIs try to batch up draw commands, this means actual drawing might not happen when it looks like it should happen. To ensure clipping is happening you must flush any buffered draws before pushing the scissor (otherwise the wrong thing might get clipped) and you must flush any draw calls before popping the scissor (otherwise things you want clipped might avoid the scissors).

                  请参阅 libgdx ScissorStack 未按预期工作 或 libGDX - 如何剪辑 或 如何在 libgdx 中使用 SpriteBatch 在屏幕的一部分上绘制? 或 使组在其范围之外隐藏Actor.

                  See libgdx ScissorStack not working as expected or libGDX - How to clip or How to draw on just a portion of the screen with SpriteBatch in libgdx? or Making a Group hide Actors outside of its bounds.

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

                  上一篇:如何在启动 Android LibGDX 项目时修复 NoClassDefFoun 下一篇:LibGdx 2 半屏“按钮"

                  相关文章

                  最新文章

                  • <bdo id='Y4AwJ'></bdo><ul id='Y4AwJ'></ul>
                  <tfoot id='Y4AwJ'></tfoot>

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

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

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