Restoring translate offset after rendering #50
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.
Hello,
First, I would like to thank you guys for both the initial library and the version
1.0
contributions, which significantly improved an already incredible library.The Issue
I'm using push to render my game in a fixed-size canvas, But I'm rendering quite a bit of UI/Editor stuff after calling
push.finish
to render them at native resolution.I've noticed that push uses
love.graphics.translate
for translating coordination to match render canvas, But we do not revert it to its previous value at the end, hence leaving the push stack with some side effects.Solution
I've fixed this by calling
love.graphics.translate
with negative offset values to cancel out the initial translation. It can also be achieved by callinglove.graphics.origin
which is what I did at first, But then I thought in some cases user may want to modify the transform matrix(for example rotating, scaling, etc) in the push stack(between start and finish), or do some translation of themselves and would want to keep it that way after calling finish, So subtracting our offset can be best approach for restoring previous value.