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.
Setting the viewport yourself could be useful in relatively niche cases (picture-in-picture, split-screen rendering) but it mostly introduces various ways to shoot yourself in the foot. Instead, it's best to focus on setting the projection, and make setting the projection very easy.
Graphics::set_viewport
has been removed, as hasfit_to_surface
andfit_to_window
.Graphics::flush
has been split into two functions,flush_surface
andflush_window
to handle setting the viewport.Setting the projection introduces the same problem.
set_projection
has been removed, andResizeHandlers
have been integrated into the automatic viewport handling. Projection is now set automatically when rendering to the Window or the Surface, and the Surface-coordinate-space issue OpenGL introduces is resolved automatically.A new function,
Graphics::set_view
, has been introduced. It allows for global transformations, between the projection and the local transform.Cursor location can be easily calculated with the new Graphics function,
screen_to_camera
. This resolves #620.The changes to the example should resolve #623.
The automatic projection resolves #631.
Checks
CHANGES.md
, with [BREAKING] next to all breaking changessrc/lib.rs
andREADME.md
were updated