Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restoring translate offset after rendering #50

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open

Conversation

rzvxa
Copy link

@rzvxa rzvxa commented Aug 5, 2023

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 calling love.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.

@rzvxa
Copy link
Author

rzvxa commented Aug 5, 2023

Probably it fixes #39
Would be great if it gets merged into #46

@rzvxa
Copy link
Author

rzvxa commented Aug 5, 2023

@Ulydev @HTV04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant