BeepSortRust/src/main.rs

41 lines
974 B
Rust
Raw Normal View History

mod BarPlugin;
mod GuiHookVec;
mod algorithm;
mod dropdown;
use std::f32::consts::PI;
use std::fs::File;
use std::path::Path;
use dropdown::ButtonDropDown;
2023-11-28 10:23:28 +00:00
use anyhow::Result;
use notan::draw::*;
use notan::prelude::*;
use tokio::runtime::Runtime;
use tokio::time::{sleep, Duration};
#[notan_main]
fn main() -> Result<(), String> {
notan::init().draw(draw).add_config(DrawConfig).build()
}
2023-11-28 10:23:28 +00:00
fn draw(gfx: &mut Graphics) {
let _ = run(gfx);
}
2023-11-28 10:23:28 +00:00
fn run(gfx: &mut Graphics) -> Result<()> {
let mut rt = Runtime::new()?;
rt.block_on(async {
let mut draw = gfx.create_draw();
draw.clear(Color::BLACK);
draw.triangle((400.0, 100.0), (100.0, 500.0), (700.0, 500.0));
gfx.render(&draw);
println!("Before sleep");
sleep(Duration::from_millis(10000)).await;
println!("After sleep");
draw.clear(Color::BLACK);
draw.rect((400., 100.), (100., 100.));
gfx.render(&draw);
});
Ok(())
}