简体   繁体   English

如何从2个矩形展开Libgdx图像

[英]How do I expand a Libgdx image from 2 rectangles

I am working on a game using LibGDX, and right now, I am working on the menu screen. 我正在使用LibGDX进行游戏,而现在,我正在菜单屏幕上进行游戏。 What I want to do, is have a small image, set a bounding box, and expand however large I need it. 我想要做的是有一幅小图像,设置一个边界框,然后将其放大到我需要的大小。 What I think would be optimal, would be to set 2 rectangles. 我认为最好是设置2个矩形。 One for width and one for height. 一为宽度,一为高度。 If it needs to get bigger or smaller, it would take that rectangle, and duplicate it beside, or beneath the current one, depending if it is for the width or height. 如果需要变大或变小,它将采用该矩形,并在当前矩形的旁边或下方复制它,具体取决于宽度或高度。 I believe there is a builtin class for this, but I cannot seem to find it. 我相信有一个内置的类,但是我似乎找不到。

You might want to take a look at NinePatch if I'm not misunderstanding your question. 如果我不误解您的问题,您可能想看看NinePatch。 Link here: https://github.com/libgdx/libgdx/wiki/Ninepatches 链接在这里: https : //github.com/libgdx/libgdx/wiki/Ninepatches

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM