summary refs log tree commit diff stats
path: root/tests/generics/tprevent_double_bind.nim
Commit message (Expand)AuthorAgeFilesLines
* 'lock levels' are deprecated, now a noop (#20539)ringabout2022-10-111-1/+1
* fixes #6732 (#11255)Andreas Rumpf2019-05-151-0/+21
a id='n23' href='#n23'>23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
# Demo of mouse support.
#
# To build a disk image:
#   ./translate apps/ex10.mu       # emits code.img
# To run:
#   qemu-system-i386 code.img
#
# Expected output:
#   Values between -256 and +255 as you move the mouse over the window.
#   You might need to click on the window once.

fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk) {
  # repeatedly print out mouse driver results if non-zero
  $main:event-loop: {
    var dx/eax: int <- copy 0
    var dy/ecx: int <- copy 0
    dx, dy <- read-mouse-event
    {
      compare dx, 0
      break-if-!=
      compare dy, 0
      break-if-!=
      loop $main:event-loop
    }
    {
      var dummy1/eax: int <- copy 0
      var dummy2/ecx: int <- copy 0
      dummy1, dummy2 <- draw-text-wrapping-right-then-down-over-full-screen screen, "         ", 0/x, 0x10/y, 0x31/fg, 0/bg
    }
    {
      var dummy/ecx: int <- copy 0
      dx, dummy <- draw-int32-decimal-wrapping-right-then-down-over-full-screen screen, dx, 0/x, 0x10/y, 0x31/fg, 0/bg
    }
    {
      var dummy/eax: int <- copy 0
      dummy, dy <- draw-int32-decimal-wrapping-right-then-down-over-full-screen screen, dy, 5/x, 0x10/y, 0x31/fg, 0/bg
    }
    loop
  }
}