LD53/src/lib.rs

32 lines
471 B
Rust
Raw Normal View History

2023-04-29 02:02:19 +00:00
#[cfg(feature = "buddy-alloc")]
mod alloc;
mod wasm4;
use wasm4::*;
2023-04-29 02:41:05 +00:00
mod helpers;
2023-04-29 03:20:04 +00:00
mod sprites;
mod world;
2023-04-29 02:41:05 +00:00
static mut WORLD: Option<world::World> = None;
2023-04-29 02:02:19 +00:00
#[no_mangle]
fn update() {
// init
unsafe {
if WORLD.is_none() {
WORLD = Some(world::World::new());
}
2023-04-29 02:02:19 +00:00
}
// update
unsafe {
WORLD.as_mut().unwrap().update();
}
2023-04-29 02:41:05 +00:00
// draw
helpers::fill(3);
unsafe {
WORLD.as_mut().unwrap().draw();
2023-04-29 03:20:04 +00:00
}
2023-04-29 02:02:19 +00:00
}