about summary refs log blame commit diff stats
path: root/graphics.mu
blob: 5f19367bec6ffe6cbc2a792c2168a1d3cbb5a6e5 (plain) (tree)
1
2
3
4
5
6
7


                                                             
                                                              

                                                               
                                









                                                        
; open a viewport, print coordinates of mouse clicks
; currently need to ctrl-c to exit after closing the viewport
(function main [
  (graphics-on (("practice" literal)) 300:literal 300:literal)
  { begin
    (pos:integer-integer-pair click?:boolean <- mouse-position)
    (loop-unless click?:boolean)
    (x:integer <- get pos:integer-integer-pair 0:offset)
    (y:integer <- get pos:integer-integer-pair 1:offset)
    (print-primitive x:integer)
    (print-primitive ((", " literal)))
    (print-primitive y:integer)
    (print-primitive (("\n" literal)))
    (loop)
  }
  (graphics-off)
])