You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently Camera::default() gives a barebones camera with no relation to set_default_camera()'s "Reset default 2D camera mode" behavior, which I believe mostly revolves around the pixel_perfect_projection_matrix() function in lib.rs as it's the None case of projection_matrix().
I ran into Camera::default() when I wanted to get around set_default_camera() not changing the viewport back to (0., 0. buffer_width, buffer_height) if a previous camera changed the context's viewport (which was going to be my original issue to post but I noticed a recent commit fixing this which is great) by using set_camera with aCamera2D equivalent to the default camera mode. That is currently what I do manually, but perhaps some clarifying documentation on Camera::default()'s role could be useful to people to avoid a quick mix-up, as well as a function that returns a Camera2D that when passed to set_camera() mirrors set_default_camera()'s behavior (assuming the viewport fix is in place).
I can see such a function being useful for avoiding some boilerplate on the user's part to allow better fine-tuning and interchanging between certain UI drawing, letterboxing, and player drawing setups. Implementing this function could also be done by rearranging some of the inner logic and returning the Camera2D as an easy convenience but I think the current pixel_perfect_projection_matrix() implementation is intentionally more efficient, so I'm not suggesting that, but rather to offer the function as an extra computational convenience. I also wouldn't pass this on to Camera::default(), as I think its role as a barebones slate is intentional as well and fits in with idiom.
As it stands with the viewport fix committed, set_default_camera() is fine enough on its own if anything but perhaps Camera::default() deserves some quick documentation at least for clarity that it is unrelated to set_default_camera() and has a different meaning.
The text was updated successfully, but these errors were encountered:
Currently
Camera::default()
gives a barebones camera with no relation toset_default_camera()
's "Reset default 2D camera mode" behavior, which I believe mostly revolves around thepixel_perfect_projection_matrix()
function in lib.rs as it's theNone
case ofprojection_matrix()
.macroquad/src/lib.rs
Lines 446 to 461 in 2f7f3c8
I ran into
Camera::default()
when I wanted to get aroundset_default_camera()
not changing the viewport back to(0., 0. buffer_width, buffer_height)
if a previous camera changed the context's viewport (which was going to be my original issue to post but I noticed a recent commit fixing this which is great) by usingset_camera
with aCamera2D
equivalent to the default camera mode. That is currently what I do manually, but perhaps some clarifying documentation onCamera::default()
's role could be useful to people to avoid a quick mix-up, as well as a function that returns aCamera2D
that when passed toset_camera()
mirrorsset_default_camera()
's behavior (assuming the viewport fix is in place).I can see such a function being useful for avoiding some boilerplate on the user's part to allow better fine-tuning and interchanging between certain UI drawing, letterboxing, and player drawing setups. Implementing this function could also be done by rearranging some of the inner logic and returning the
Camera2D
as an easy convenience but I think the currentpixel_perfect_projection_matrix()
implementation is intentionally more efficient, so I'm not suggesting that, but rather to offer the function as an extra computational convenience. I also wouldn't pass this on toCamera::default()
, as I think its role as a barebones slate is intentional as well and fits in with idiom.As it stands with the viewport fix committed,
set_default_camera()
is fine enough on its own if anything but perhapsCamera::default()
deserves some quick documentation at least for clarity that it is unrelated toset_default_camera()
and has a different meaning.The text was updated successfully, but these errors were encountered: