This repository has been archived by the owner on May 18, 2022. It is now read-only.
Refactor nannou_egui
and add some basic docs
#8
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.
This refactor aims to clean up the
nannou_egui
code a little, andprovide a slightly more modular, cleaner interface (though for the most
part usage is almost identical other than some name changes).
One notable change is the use of RAII to "end the frame". The aim is to
avoid the situation where users forget to call
end_frame
, oraccidentally call
end_frame
on the innerCtxRef
rather thantop-level API.
begin_frame
now returns aFrameCtx
- a type thatderefs to a
CtxRef
and automatically callsend_frame
and tesselatesgraphics when it is dropped. Users can call
FrameCtx::end
if they wishto end the frame before
drop
is invoked. Alternatively, they can justcall
begin_frame
within a block.@AlexEne let me know your thoughts! I think I'll probably start using
this in a large downstream project soon.
This PR is based on #6, so it might be easier to review after merging that first.