• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Asset - Graphics GM.9patch

GMWolf

aka fel666
GM.9patch
marketplace link: https://marketplace.yoyogames.com/assets/5027/gm9patch

GM.9path helps you easilly define 9patch sprites, by simply adding borders in the sprite editor.
Define any number of stretchable / non-stretchable regions.
Slide3.PNG
Slide3.PNG Slide4.PNG Slide5.PNG Slide6.PNG
Defining your 9patch
Defining you 9patch is as easy as adding '_9p' at the end of the sprite name, and adding a border of stretchable and non stretchable region around the image.
Need a section in the middle to stay unstretched? No problem, GM.9patch supports any number of patched regions!
Easily fit text in your sprite by defining the content regions in the sprite editor!
This is compatible with the 9patch format used in android developemnt, making it ideal to reuse androif resources.

Draw you 9patch easily with
Code:
draw_9patch(sprite, subimage, x, y, width, height);
or add text with
Code:
draw_9patch_text(sprite, subimage, x, y, width, height, text)
Extended versions also available to change rotation, colour and alpha.
 
Last edited:

GMWolf

aka fel666
Quick update: easily get the content region with this new function: get_9patch_content_rectangle.

takes in sprite, position and dimentions of the panel, and returns an array with position and dimentions of the content region! Adding your own sprite, text or other flush inside a panel is now much easier!
 
Top