add sound to skipahead

This commit is contained in:
2022-05-08 20:28:06 +02:00
parent 599873890a
commit a02243d98c
2 changed files with 7 additions and 2 deletions

View File

@@ -8,7 +8,7 @@ global mut f: f32 = 2.0;
export fn upd() { export fn upd() {
let y: i32; let y: i32;
let inline zero = 0.0; let inline zero = 0_f;
let lazy control_speed = 0.03125; let lazy control_speed = 0.03125;
s = s + 0.1875 - (f + control_speed) * isButtonPressed(4 <| cls(4)) as f32; 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 y == 180 & py > zero {
if x > w | x < zero { if x > w | x < zero {
80?0 = 0xc1;
return; return;
} }
py = zero; py = zero;
@@ -43,6 +44,10 @@ export fn upd() {
circle(160 as f32, 160 as f32 + py, 22 as f32, -28); 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); 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; px = px + (isButtonPressed(3) - isButtonPressed(2)) as f32 * control_speed;
py = py + s; py = py + s;
pz = pz + 1; pz = pz + 1;

View File

@@ -402,7 +402,7 @@ fn init_sound(
let buffer_size = match *config.buffer_size() { let buffer_size = match *config.buffer_size() {
cpal::SupportedBufferSize::Unknown => cpal::BufferSize::Default, cpal::SupportedBufferSize::Unknown => cpal::BufferSize::Default,
cpal::SupportedBufferSize::Range { min, max } => { 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 { let config = cpal::StreamConfig {