eframe app creation refactor #1363
Merged
+387
−444
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 refactors how eframe creates an app, removing the need for
App::setup
.The purpose of this is to be able to access the following state before/during creation of ones app:
egui::Context
: alllow users to set fonts, style and maybe create textures.epi::Storage
: for reading app state from storage.epi::Frame
: can be cloned and stored so we can runrequest_repaint
.glow::Context
: for creating rendering resources.Previously eframe was designed so that these were passed into
App::setup
, but that meant one would have to create an app before running the setup of it, makingApp::setup
a weird "second constructor". This PR solves that problem.App::name
is now also removed, and is instead passed in by argument toeframe::run_native
.Additionally,
eframe
now re-exports everything inepi
, soeframe
users can ignoreepi
completely.This now changes the
eframe
use to look like so:EDIT: this has been edited to reflect the changes added in #1373