The wzzc-dev fork of moonbit-community/window, tracking upstream 0.5.4 while adding MoUI-oriented desktop, Web, and mobile backends.
Dependencies
cmd /k "C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64where.exe cl
moon build modules\window\examples\window_windows --target native
moon run modules\window\examples\window_windows --target nativewhere.exe gcc
moon build modules\window\examples\window_windows --target native
moon run modules\window\examples\window_windows --target nativemoon build modules/window/examples/window_web --target wasm-gcnode modules/window/examples/window_web/serve.mjshttp://127.0.0.1:8000/modules/window/examples/window_web/index.html_build/wasm-gc/debug/build/examples/window_web/window_web.wasmsudo apt install libwayland-dev wayland-protocols wayland-scanner pkg-configmoon build modules/window/examples/window_linux --target native
moon run modules/window/examples/window_linux --target nativemoon add wzzc-dev/windowimport {
"wzzc-dev/window/core",
"wzzc-dev/window/macos",
}
supported_targets = "native"
options("is-main": true)///|
struct App {
mut window : @macos.Window?
}
///|
pub impl @macos.ApplicationHandler for App with can_create_surfaces(
self,
event_loop,
) {
let attrs = @core.WindowAttributes::default().with_title("window demo")
let window : @macos.Window? = Some(event_loop.try_create_window(attrs)) catch {
err => {
println("error creating window: \{err}")
event_loop.exit()
None
}
}
self.window = window
}
///|
pub impl @macos.ApplicationHandler for App with window_event(
self,
event_loop,
_id,
event,
) {
match event {
CloseRequested => event_loop.exit()
SurfaceResized(_) =>
match self.window {
Some(window) => window.request_redraw()
None => ()
}
RedrawRequested => println("redraw requested")
_ => ()
}
}
///|
fn main {
let event_loop = @macos.EventLoop::EventLoop()
event_loop.run_app({ window: None })
}let raw = try! window.window_handle().as_raw()
match raw {
@windowing.RawWindowHandle::AppKit(handle) => {
let ns_view = handle.ns_view()
// Create the renderer surface from ns_view.
}
_ => abort("renderer does not support this window backend")
}///|
pub impl @macos.ApplicationHandler for App with window_event(
self,
event_loop,
_id,
event,
) {
match event {
PointerMoved(_, position, _, _) =>
println("pointer moved: \{position}")
DragEntered(paths, position) =>
println("drag entered at \{position}: \{paths}")
CloseRequested => event_loop.exit()
_ => ()
}
}moon run modules/window/examples/window --target native
moon run modules/window/examples/window_windows --target native
moon build modules/window/examples/window_web --target wasm-gc
moon run modules/window/examples/window_linux --target nativescripts/check_ci.shRUN_EXAMPLE_TRANSCRIPTS=1 scripts/check_ci.shThe wzzc-dev fork of moonbit-community/window, tracking upstream 0.5.4 while adding MoUI-oriented desktop, Web, and mobile backends.
Dependencies