• Godot HelpGUI
  • Can I make a Texture button with a Patch9Frame functionnality ?

Hi,

I would like to do several texture buttons with several size with a "9 patch frame" texture on it, the texturebutton class offers for example scale of the texture, but it stretch the texture and I would not, and I can't specify patch margin in it.

I would like a button like the green one (9 patched independent of the size with no stretch) in the image below.

Is there a way to do this ? Regards,

linkoboy

a month later

I believe 9 patch is being added to Godot 3.0 so you'll have to do it manually for the time being.

a month later

there is a patch 9 in 2.1 but you would need to write your own button functions for it because its not connected to basebutton class (detecing inputs from within processing script) -i think

Just use a standard Button node, then apply custom styles to it (which lets you use patch-9 textures).

Note that Godot 3.0 will support more extended texture-less GUI theming options (StyleBoxFlat): rounded/beveled corners, per-border widths and drop shadows will all be possible, which makes resorting to textures less needed.

Thanks for your answers,

For the moment, I've created a base scene "patch_button.scn" like in the screenshot : it's surely not the best solution but it give the fonctionnalities that I need.

I'm looking forward to seeing the new features of Godot 3.0, it looks great !

5 years later