Scaled object's image shifts relative to object's "origin". In case of GUI that's top-left corner. If user wants to have scaling relative to GUI's center, they will have to adjust X,Y position as well.
Negative values are allowed and result in mirrored image. That's not "intentional", it just works this way... If this seems redundant, it's easy to force to strictly positive values.
Scale value 0 is allowed and means that the object is not drawn at all.
Note that visual results depend on number of factors, including game resolution, gui size, scaling.
"Render sprites at screen resolution" makes dramatic change in both upscale and downscale quality.
ISSUES
Scaling rotated GUI has unexpected results, where either origin or pivot point is being shifted around (scaled?), resulting in GUI visibly moving around while being scaled as well.
Either this is a problem with GUI's pivot not being the same location as origin, or a wrong order of transforms again...
A care has to be taken, make sure that any fixes to this won't break other types of objects that have different combinations of default origin/pivot.
EDIT: this seems to be a consequence of having separate origin and pivot point.
This may be proven by centering a gui using a script, for example:
int guix = gMyGUI.X;
int guiy = gMyGUI.Y;
float guisx = gMyGUI.ScaleX;
float guisy = gMyGUI.ScaleY;
// do some scaling and rotation
gMyGUI.X = guix + FloatToInt((IntToFloat(gMyGUI.Width) * guisx - IntToFloat(gMyGUI.Width) * gMyGUI.ScaleX) / 2.0, eRoundNearest);
gMyGUI.Y = guiy + FloatToInt((IntToFloat(gMyGUI.Height) * guisy - IntToFloat(gMyGUI.Height) * gMyGUI.ScaleY) / 2.0, eRoundNearest);
Implements script API for GUI scaling. Set as draft for now, in case API receives any criticism.
Adds:
All scale values are set in floats, and used as direct scaling factors, which means that
Scaled object's image shifts relative to object's "origin". In case of GUI that's top-left corner. If user wants to have scaling relative to GUI's center, they will have to adjust X,Y position as well.
Negative values are allowed and result in mirrored image. That's not "intentional", it just works this way... If this seems redundant, it's easy to force to strictly positive values. Scale value
0
is allowed and means that the object is not drawn at all.Note that visual results depend on number of factors, including game resolution, gui size, scaling. "Render sprites at screen resolution" makes dramatic change in both upscale and downscale quality.
ISSUES
Scaling rotated GUI has unexpected results, where either origin or pivot point is being shifted around (scaled?), resulting in GUI visibly moving around while being scaled as well. Either this is a problem with GUI's pivot not being the same location as origin, or a wrong order of transforms again... A care has to be taken, make sure that any fixes to this won't break other types of objects that have different combinations of default origin/pivot. EDIT: this seems to be a consequence of having separate origin and pivot point. This may be proven by centering a gui using a script, for example: