xloop_wasm 0.1.1

wasm impl for xloop.
Documentation
use super::Platform;

#[derive(Clone, Copy)]
pub struct WinRef<'a>(pub &'a Win);
impl<'a> types::WinRef<Platform> for WinRef<'a> {
	fn raw(&self) -> Option<WinRaw> {
		use core::ffi::c_void;
		let view = &self.0.canvas as *const _ as *const c_void;
		let view = view as *mut c_void;
		return Some(WinRaw::from(view));
	}
	fn show(&self) {
		self.0.canvas.set_hidden(false)
	}
	fn close(&self) {
		// not surport
	}
	fn fresh(&self, reason: &str) {
		self.0.dirty(reason);
	}
	fn size(&self) -> (u32, u32) {
		let w = self.0.canvas.width();
		let h = self.0.canvas.height();
		(w, h)
	}
	fn density(&self) -> f32 {
		// size is logic,so here return 1.
		1.
		// let scale = self.0.window.device_pixel_ratio();
		// (1. / scale) as _
	}
}

#[derive(Debug)]
pub struct WinHandle(pub thunderdome::Index);
impl types::WinHandle<Platform> for WinHandle {
	fn with(&self, mut fun: impl FnMut(WinRef<'_>)) {
		with_win(self.0, |win| {
			fun(WinRef(win));
			Some(())
		});
	}
}

mod win;
pub use win::*;

mod raw;
pub use raw::*;

mod event;
pub use event::*;