S003: shots press and hover at 60 Hz
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
parent
529c509c05
commit
60142de6ee
1 changed files with 10 additions and 10 deletions
|
|
@ -35,7 +35,7 @@ fn sources() -> Sources {
|
|||
|
||||
fn harness(scene: Scene, appearance: Appearance, size: (f32, f32)) -> Harness<'static> {
|
||||
let mut app = None;
|
||||
Harness::builder().with_size(vec2(size.0, size.1)).wgpu().build_ui(move |ui| {
|
||||
Harness::builder().with_size(vec2(size.0, size.1)).with_step_dt(1.0 / 60.0).wgpu().build_ui(move |ui| {
|
||||
if app.is_none() {
|
||||
// Fonts count from the next frame.
|
||||
app = Some(App::new(ui.ctx(), settings(appearance), sources()));
|
||||
|
|
@ -59,17 +59,17 @@ fn shots() {
|
|||
for (mode, appearance) in [("light", Appearance::Light), ("dark", Appearance::Dark)] {
|
||||
for size in sizes.split(',') {
|
||||
let mut h = harness(*scene, appearance, pair(size, 'x').expect("SIZES=WxH,WxH"));
|
||||
// The pointer meets what the last frame drew.
|
||||
h.run_steps(2);
|
||||
if let Some((x, y)) = hover {
|
||||
let at = pos2(x, y);
|
||||
h.input_mut().events.push(Event::PointerMoved(at));
|
||||
h.step();
|
||||
if std::env::var_os("PRESS").is_some() {
|
||||
let press = Event::PointerButton { pos: at, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE };
|
||||
h.input_mut().events.push(press);
|
||||
}
|
||||
h.input_mut().events.push(Event::PointerMoved(pos2(x, y)));
|
||||
}
|
||||
for _ in 0..60 {
|
||||
h.step();
|
||||
h.run_steps(60);
|
||||
if let Some((x, y)) = hover.filter(|_| std::env::var_os("PRESS").is_some()) {
|
||||
let pos = pos2(x, y);
|
||||
h.input_mut().events.push(Event::PointerButton { pos, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE });
|
||||
// egui gives up on a click held for 0.8 s.
|
||||
h.run_steps(30);
|
||||
}
|
||||
if let Some(dir) = &out {
|
||||
h.render().expect("render").save(format!("{dir}/{}-{mode}-{size}.png", scene.0)).unwrap();
|
||||
|
|
|
|||
Loading…
Reference in a new issue