-
Notifications
You must be signed in to change notification settings - Fork 31
Add viewport value blocks #92
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
Conversation
3a2d552 to
cf4fa0d
Compare
wnbaum
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely good to have some sort of blocks like these!
One issue I can think of is that the viewport width, height, and center are all in viewport pixel coordinates, not in our 2D scene coordinates. So when we get the viewport center, it is not the same as the 2D scene center that our camera is fixed on. We might want to add some extra conversion there.
wnbaum
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's some suggestions that I forgot to add to the other review!
Yes, this seems to be the convertion we need: https://forum.godotengine.org/t/how-do-i-get-the-center-of-the-screen-without-using-camera/20545/3?u=manuq In the current architecture we can't do that easily. I managed to do it with lambda functions. The code looks bad but it works in Pong to reset the ball. See the fixup commit. I also appended another commit to construct a Vector2 from X, Y float parameters. So these 2 are equivalent: |
To integer blocks for the viewport width and height. And one Vecto2 block for the viewport center.
Co-authored-by: wnbaum <42101167+wnbaum@users.noreply.github.com>
Co-authored-by: wnbaum <42101167+wnbaum@users.noreply.github.com>
Co-authored-by: wnbaum <42101167+wnbaum@users.noreply.github.com>
7c8453e to
c8808b9
Compare
wnbaum
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working as expected! Code looks good to me. The generated code with the lambdas is definitely ugly, but that's something to figure out in another PR.


To integer blocks for the viewport width and height. And one Vecto2 block for the viewport center.