We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2bed060 commit da10a8eCopy full SHA for da10a8e
README.md
@@ -7,7 +7,32 @@ Idiomatic bindings for WASM-4 in Rust.
7
cartridges (ROMs) are small, self-contained `.wasm` files that can be built with any programming
8
language that compiles to WebAssembly.
9
10
-Usage
+Example
11
----
12
13
-TODO
+```rust
14
+#![no_main]
15
+
16
+use wasm4 as w4;
17
18
+struct MyRuntime {
19
+ count: i32,
20
+}
21
22
+// prints "tick" every second
23
+impl w4::rt::Runtime for MyRuntime {
24
+ fn start(_: w4::rt::Resources) -> Self {
25
+ MyRuntime { count: 0 }
26
+ }
27
28
+ fn update(&mut self) {
29
+ if self.count % 60 == 0 {
30
+ w4::trace("tick");
31
+ self.count = 0;
32
33
+ self.count += 1;
34
35
36
37
+w4::main! { MyRuntime }
38
+```
0 commit comments