From 349055ef2533bf3268f37d3c04e5adb84814f50a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Sat, 30 Jan 2021 23:24:05 +0100 Subject: remove tokio from pong --- pong/Cargo.toml | 1 - pong/pong.tdy | 1 - pong/src/main.rs | 13 ------------- 3 files changed, 15 deletions(-) (limited to 'pong') diff --git a/pong/Cargo.toml b/pong/Cargo.toml index 8e8cace..99b2d36 100644 --- a/pong/Cargo.toml +++ b/pong/Cargo.toml @@ -11,4 +11,3 @@ tihdy = { path = ".."} tihdy_derive = { path = "../tihdy_derive" } macroquad = "0.2" -tokio = { version = "1", features = ["rt", "rt-multi-thread"] } diff --git a/pong/pong.tdy b/pong/pong.tdy index 7088f2e..24886c8 100644 --- a/pong/pong.tdy +++ b/pong/pong.tdy @@ -34,7 +34,6 @@ draw := fn state: State { clear() draw_rectangle(state.p1.paddle.x, state.p1.paddle.y, 0.2, 1.) draw_rectangle(state.p2.paddle.x, state.p2.paddle.y, 0.2, 1.) - next_frame() } init := fn { diff --git a/pong/src/main.rs b/pong/src/main.rs index 6382e92..c3cc0bf 100644 --- a/pong/src/main.rs +++ b/pong/src/main.rs @@ -33,15 +33,6 @@ extern_function!(key_down }, ); -extern_function!(my_next_frame - [] -> Type::Void => { - tokio::spawn(async { - next_frame().await - }); - Ok(Value::Nil) - }, -); - extern_function!(my_draw_rectangle [Value::Float(x), Value::Float(y), Value::Float(w), Value::Float(h)] -> Type::Void => { draw_rectangle(*x as f32, *y as f32, *w as f32, *h as f32, DARKPURPLE); @@ -64,18 +55,14 @@ async fn main() { ..Default::default() }); - let rt = tokio::runtime::Runtime::new().unwrap(); - let functions: Vec<(String, tihdy::RustFunction)> = vec![ ("log".to_string(), log), ("get_delta".to_string(), get_delta), ("key_down".to_string(), key_down), - ("next_frame".to_string(), my_next_frame), ("draw_rectangle".to_string(), my_draw_rectangle), ("clear".to_string(), clear), ]; - let _guard = rt.enter(); // so we can async { next_frame().await } let vm = tihdy::compile_file(Path::new("pong.tdy"), false, functions); if let Err(errs) = vm { for err in errs { -- cgit v1.2.1