wgui: components base, anyhow event listener callbacks, 📦📎-fixes, typo fixes
This commit is contained in:
@@ -92,7 +92,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
};
|
||||
|
||||
let mut recreate = false;
|
||||
let mut last_draw = std::time::Instant::now();
|
||||
|
||||
let mut scale = window.scale_factor() as f32;
|
||||
|
||||
@@ -302,8 +301,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
let tgt = images[image_index as usize].clone();
|
||||
|
||||
last_draw = std::time::Instant::now();
|
||||
|
||||
let mut cmd_buf = gfx
|
||||
.create_gfx_command_buffer(CommandBufferUsage::OneTimeSubmit)
|
||||
.unwrap();
|
||||
@@ -337,9 +334,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
profiler.end();
|
||||
}
|
||||
Event::AboutToWait => {
|
||||
if last_draw.elapsed().as_millis() > 16 {
|
||||
window.request_redraw();
|
||||
}
|
||||
// should be limited to vsync
|
||||
window.request_redraw();
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
|
||||
@@ -33,12 +33,13 @@ fn button_click_callback(
|
||||
Translation::from_raw_text(text),
|
||||
);
|
||||
|
||||
// FIXME: remove unwrap
|
||||
button.try_cast::<ComponentButton>().unwrap().set_text(
|
||||
button.try_cast::<ComponentButton>()?.set_text(
|
||||
e.state,
|
||||
e.alterables,
|
||||
Translation::from_raw_text("this button has been clicked"),
|
||||
);
|
||||
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -70,6 +71,7 @@ impl TestbedGeneric {
|
||||
e.alterables,
|
||||
Translation::from_raw_text("congrats!"),
|
||||
);
|
||||
Ok(())
|
||||
}));
|
||||
|
||||
let button_red = state.fetch_component_as::<ComponentButton>("button_red")?;
|
||||
|
||||
Reference in New Issue
Block a user