 
 M: maze pref-dim* drop { 400 400 } ;
 
+M: maze handle-gesture
+    over T{ button-down { # 1 } } =
+    [ nip relayout f ] [ call-next-method ] if ;
+
 MAIN-WINDOW: maze-window { { title "Maze" } }
     <maze> >>gadgets ;
-
-MAIN: maze-window

! From http://www.ffconsultancy.com/ocaml/maze/index.html
USING: accessors arrays kernel math math.order math.vectors
namespaces opengl.demo-support opengl.gl random sequences ui
ui.gadgets ui.gadgets.canvas ui.render ;
IN: maze

CONSTANT: line-width 8

    GL_LINE_STRIP glBegin
    dup vertex
    dup visit
    dup random-neighbour [
        (draw-maze) (draw-maze)
    ] [
        drop
        glEnd
        GL_LINE_STRIP glBegin
    ] if* ;

: draw-maze ( n -- )
    line-width 2 - glLineWidth
