refresh
Requests another frame to be shown.
This only matters if you are using dvui to manage the framerate (by calling
Window.waitTime and using the return value to wait with event
interruption - for example sdl_backend.waitEventTimeout at the end of each
frame).
src and id are for debugging, which is enabled by calling
Window.debug.logRefresh(true). The debug window has a toggle button for this.
Can be called from any thread.
If called from non-GUI thread or outside Window.begin/Window.end, you must
pass a pointer to the Window you want to refresh. In that case dvui will
go through the backend because the gui thread might be waiting.
Parameters
Source
Implementation
pub fn refresh(win: ?*Window, src: std.builtin.SourceLocation, id: ?Id) void {
if (win) |w| {
// we are being called from non gui thread, the gui thread might be
// sleeping, so need to trigger a wakeup via the backend
w.refreshBackend(src, id);
} else if (current_window) |cw| {
cw.refreshWindow(src, id);
} else {
log.err("{s}:{d} refresh current_window was null, pass a *Window as first parameter if calling from other thread or outside window.begin()/end()", .{ src.file, src.line });
}
}