Skip to content

Reactive draw mode #24

@parasyte

Description

@parasyte

The GUI currently redraws every frame at the display's refresh rate (e.g. 180 fps on my 180 Hz monitor). Even if there are no changes between frames.

We can easily switch to a reactive mode by only redrawing when egui requests it:

cartunes/src/framework.rs

Lines 150 to 155 in 2a3b989

// End the egui frame and create all paint jobs to prepare for rendering.
// TODO: Handle output.needs_repaint to avoid game-mode continuous redraws.
let (output, paint_commands) = self.egui_ctx.end_frame();
self.egui_state
.handle_output(window, &self.egui_ctx, output);
self.paint_jobs = self.egui_ctx.tessellate(paint_commands);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions