sound test wasm

This commit is contained in:
Rolf Martin Glomsrud 2023-03-04 21:47:37 +01:00
parent 3e013192d0
commit 67090986bb
5 changed files with 21 additions and 73 deletions

32
Cargo.lock generated
View file

@ -6,10 +6,10 @@ version = 3
name = "BeepSortMacroQuad"
version = "0.1.0"
dependencies = [
"async-recursion",
"async-trait",
"macroquad",
"tokio-test",
"wav",
]
[[package]]
@ -29,17 +29,6 @@ dependencies = [
"version_check",
]
[[package]]
name = "async-recursion"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b015a331cc64ebd1774ba119538573603427eaace0a1950c423ab971f903796"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "async-stream"
version = "0.3.4"
@ -99,9 +88,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "bitflags"
version = "1.3.2"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
[[package]]
name = "bumpalo"
@ -434,6 +423,12 @@ dependencies = [
"proc-macro2",
]
[[package]]
name = "riff"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9b1a3d5f46d53f4a3478e2be4a5a5ce5108ea58b100dcd139830eae7f79a3a1"
[[package]]
name = "smallvec"
version = "0.6.14"
@ -513,6 +508,15 @@ version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wav"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a65e199c799848b4f997072aa4d673c034f80f40191f97fe2f0a23f410be1609"
dependencies = [
"riff",
]
[[package]]
name = "winapi"
version = "0.3.9"

View file

@ -9,6 +9,6 @@ edition = "2021"
macroquad = "0.3.25"
async-trait = "0.1.64"
tokio-test = "*"
async-recursion = "1.0.2"
wav = "1.0.0"
[profile.release]
opt-level=3

View file

@ -1,7 +1,5 @@
use std::borrow::{Borrow, BorrowMut};
use std::ops::Add;
use std::path::Iter;
use async_trait::async_trait;
use macroquad::color::{BROWN, WHITE};
use macroquad::hash;
@ -13,7 +11,7 @@ use macroquad::time::{get_frame_time, get_fps};
use macroquad::ui::root_ui;
use macroquad::window::{next_frame, screen_height, screen_width};
use crate::BarPlugin::Bar;
use crate::algorithm::Algorithm;

View file

@ -1,54 +0,0 @@
mod BarPlugin;
mod GuiHookVec;
mod algorithm;
mod dropdown;
use dropdown::ButtonDropDown;
use macroquad::prelude::*;
use macroquad::hash;
use macroquad::ui::root_ui;
#[macroquad::main("BeepSort")]
async fn main() {
let mut length = 1_usize;
let mut lengthString = "100".to_owned();
let mut delayText = "1".to_owned();
let mut algorithm = algorithm::Algorithm::new();
let mut buttonDropDown = ButtonDropDown::new(&algorithm.getAlgorithms());
loop{
clear_background(WHITE);
length = match lengthString.parse::<usize>(){
Ok(a) => a,
Err(_)=> {100}
};
let mut centerX = screen_width()/2.0;
draw_text("Sorting!", centerX-170.0, screen_height()*0.1, 100.0, BLACK);
draw_text(&get_fps().to_string(), centerX + 300., 30.0, 20.0, BLACK);
root_ui().window(hash!(), Vec2::new(centerX - 150.0, 150.), Vec2::new(300., 45.), |ui|{
ui.input_text(hash!(), "Delay (ms)", &mut delayText);
ui.input_text(hash!(), "Length Of Array!", &mut lengthString);
});
let mut algo = buttonDropDown.render();
if algo != ""{
algorithm::Algorithm::run(length, 1.0, algo.to_string()).await;
}
next_frame().await
}
}

BIN
src/test.wav Normal file

Binary file not shown.