From a02243d98c9b759def48d21d4d88890546d019f6 Mon Sep 17 00:00:00 2001 From: Dennis Ranke Date: Sun, 8 May 2022 20:28:06 +0200 Subject: [PATCH] add sound to skipahead --- examples/curlywas/skipahead.cwa | 7 ++++++- src/run_native.rs | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/curlywas/skipahead.cwa b/examples/curlywas/skipahead.cwa index a080f80..b2aab2f 100644 --- a/examples/curlywas/skipahead.cwa +++ b/examples/curlywas/skipahead.cwa @@ -8,7 +8,7 @@ global mut f: f32 = 2.0; export fn upd() { let y: i32; - let inline zero = 0.0; + let inline zero = 0_f; let lazy control_speed = 0.03125; s = s + 0.1875 - (f + control_speed) * isButtonPressed(4 <| cls(4)) as f32; @@ -30,6 +30,7 @@ export fn upd() { if y == 180 & py > zero { if x > w | x < zero { + 80?0 = 0xc1; return; } py = zero; @@ -43,6 +44,10 @@ export fn upd() { circle(160 as f32, 160 as f32 + py, 22 as f32, -28); circle((160 - 6) as f32, (160 - 6) as f32 + py, 6 as f32, -26); + 86?0 = py < zero; + 86?3 = 32 - py as i32; + 80?3 = 32; + px = px + (isButtonPressed(3) - isButtonPressed(2)) as f32 * control_speed; py = py + s; pz = pz + 1; diff --git a/src/run_native.rs b/src/run_native.rs index fcd142b..e5e5de2 100644 --- a/src/run_native.rs +++ b/src/run_native.rs @@ -402,7 +402,7 @@ fn init_sound( let buffer_size = match *config.buffer_size() { cpal::SupportedBufferSize::Unknown => cpal::BufferSize::Default, cpal::SupportedBufferSize::Range { min, max } => { - cpal::BufferSize::Fixed(65536.max(min).min(max)) + cpal::BufferSize::Fixed(256.max(min).min(max)) } }; let config = cpal::StreamConfig {