Search code examples
javalibgdx

libgdx Resizing an Image with Border


i have an image with a 5px black border what i will use for serveral buttons. The only problem is, that the buttons have different sizes. Is there a way to resize it properly? The only way i can figure it out, is to split it in individually pieces.

Eg.: The Image is 200x200 and the Button 200x200 -> Border is ok. The Image is 200x200 (the same) and the button 400x200 -> Border is stretched.


Solution

  • After the last Months i´ve learned very much about libgdx and i must say that the use of ninepatches are the best solution.

    See here to learn more about 9patch in libGDX