AGS 4: Add GUI.ScaleX, ScaleY and SetScale(x,y) #2426
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.