Preparing your sprites for gooey
In general, gooey relies on regular GameMaker sprites to do its rendering. However, you will need to configure some settings in order to be able to use them appropriately.
Configure nine-slicing for your sprites
Nine-slicing is a feature in GameMaker that allows you to define how sprites are scaled. When nine slicing is not enabled, sprites will stretch in the direction you set it. If you do not keep the same aspect ratio as the original size, yous sprite will distort. This will carry into gooey if you are using those sprites for drawing things like panels, buttons, etc. With nine-slicing enabled, your corners will stay the same aspect ratio and the middle parts will stretch nicely (or repeat, depending on configuration), preventing distortion.
gooey stretches most sprites when rendering1. Hence, you need to set up nine-slicing for your sprites. Refer to the GameMaker manual for more info on how to set this up.
You can see the effect of having nine-slice enabled or disabled in this example (click and drag around the edges of the panels to resize them):
Configure origins to top left
Certain parts of gooey rely on the sprites having a top left origin point, so it's best to set them that way.
If for some reason you cannot do this (for example, if you are already using the same sprite as an object sprite, and you need that sprite to have a different origin, and you do not want to duplicate it), you can get the top left origin point using the built-in sprite_get_xoffset() and sprite_get_yoffset() functions, and setting up your UI offsets by adding the sprite offset to the position.
Manage your UI assets in specific texture groups
If you are developing a very big project, perhaps it's best to create separate texture groups and pages, depending on which parts of the UI will show up in what parts of your game. You can review the GameMaker manual page for texture groups in order to optimize texture swaps.
Note that this is not needed in most cases.
-
Certain widgets, such as the progress bar widget, do not currently work with nine-sliced sprites, but rather with fixed-size sprites. ↩