Skip to content

Commit

Permalink
Merge pull request #798 from UnusualEgg/patch-1
Browse files Browse the repository at this point in the history
add zig to user-input.md
  • Loading branch information
aduros authored Jan 22, 2025
2 parents 368fdfe + f54ef7e commit 1b29b4b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions site/docs/guides/user-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -476,4 +476,20 @@ fn update() {
}
```

```zig
export fn update() void {
const mouse = w4.MOUSE_BUTTONS.*;
const mouseX = w4.MOUSE_X.*;
const mouseY = w4.MOUSE_Y.*;
if (mouse & w4.MOUSE_LEFT) {
w4.DRAW_COLORS.* = 4;
w4.rect(@as(i32, mouseX) - 8, @as(i32, mouseY) - 8, 16, 16);
} else {
w4.DRAW_COLORS.* = 2;
w4.rect(@as(i32, mouseX) - 4, @as(i32, mouseY) - 4, 8, 8);
}
}
```

</MultiLanguageCode>

0 comments on commit 1b29b4b

Please sign in to comment.