[−][src]Trait coffee::load::loading_screen::LoadingScreen
A loading screen keeps track of the progress of a task and provides feedback to the user.
Usage
If you have a LoadingScreen
, set it as your Game::LoadingScreen
associated type. Coffee will automatically use it when your game starts!
Future plans
As of now, Coffee only ships with the ProgressBar
loading screen. In the
near future, the plan is to add more interesting (and configurable!) loading
screens. If you make a cool loading screen or have an interesting idea and
you would like to share it, feel free to create an issue or
open a pull request!
Required methods
fn new(gpu: &mut Gpu) -> Result<Self> where
Self: Sized,
Self: Sized,
Creates the LoadingScreen
.
You can use the provided [Gpu
] to load the assets necessary to show
the loading screen.
fn draw(&mut self, progress: &Progress, frame: &mut Frame)
Draws the LoadingScreen
with the given Progress
.
You should provide feedback to the user here. You can draw on the given
Frame
, like in Game::draw
.
Provided methods
fn run<T>(&mut self, task: Task<T>, window: &mut Window) -> Result<T>
Runs the LoadingScreen
with a task and obtain its result.
By default, it runs the task and refreshes the window when there is progress.