1 # Demo of mouse support.
3 # To build a disk image:
4 # ./translate apps/ex10.mu # emits code.img
6 # qemu-system-i386 code.img
9 # Values between -256 and +255 as you move the mouse over the window.
10 # You might need to click on the window once.
12 fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk) {
13 # repeatedly print out mouse driver results if non-zero
15 var dx/eax: int <- copy 0
16 var dy/ecx: int <- copy 0
17 dx, dy <- read-mouse-event
26 var dummy1/eax: int <- copy 0
27 var dummy2/ecx: int <- copy 0
28 dummy1, dummy2 <- draw-text-wrapping-right-then-down-over-full-screen screen, " ", 0/x, 0x10/y, 0x31/fg, 0/bg
31 var dummy/ecx: int <- copy 0
32 dx, dummy <- draw-int32-decimal-wrapping-right-then-down-over-full-screen screen, dx, 0/x, 0x10/y, 0x31/fg, 0/bg
35 var dummy/eax: int <- copy 0
36 dummy, dy <- draw-int32-decimal-wrapping-right-then-down-over-full-screen screen, dy, 5/x, 0x10/y, 0x31/fg, 0/bg