所以我正在进行2D像素游戏,而且我在屏幕上绘制9ptach纹理时遇到了麻烦。
代码:
TextureRegion texture = TextureManager.navigationButton;
NinePatch patch = new NinePatch(texture, 1, 1, 1, 1);
NinePatchDrawable ninePatch = new NinePatchDrawable(patch);
background = new Image(ninePatch);
TextureManager.navigationButton只是atlas .9 texturregion
navigationButton = textureAtlas.findRegion("navigationmenu.9");
我尝试将九个补丁值从0改为10左右,但没有任何帮助。
答案 0 :(得分:0)
您应该将for(auto it:iterators(vec))
作品委托给Skin。
1, 1, 1, 1
但是如果您想使用Skin,您可能希望使用按钮的全部功能,例如ImageButton。因此,您可以在皮肤本身中定义// load the skin first
Skin skin = new Skin(...); // well, you can use even empty skin
skin.addRegions(textureAtlas);
// get the nine-patch from it
NinePatch patch = skin.getPatch("navigationmenu");
NinePatchDrawable ninePatch = new NinePatchDrawable(patch);
background = new Image(ninePatch);
个变量:
navigationmenu
然后做这个魔术:
"com.badlogic.gdx.scenes.scene2d.ui.ImageButton$ImageButtonStyle":
{
"button-navigation":
{
"imageUp": "navigationmenu"
}
}