1 USING: accessors sequences kernel opengl gamelib.ui colors math
2 math.vectors ui.gadgets.tracks ui.gestures ui.gadgets
3 gamelib.board assocs calendar timers ;
5 IN: multiple-board-demo
7 : board-init ( -- board )
9 { 0 0 } COLOR: blue add-to-cell
12 :: move ( board mov -- )
13 board [ COLOR: blue = ] find-cell-pos :> player-pos
14 player-pos mov v+ :> new-pos
16 new-pos first 10 < and
17 [ board player-pos new-pos move-entire-cell drop ] when ;
19 :: first-gadget ( -- gadget )
20 { 400 400 } init-board-gadget
21 T{ key-down f f "RIGHT" } [ dup board>> first RIGHT move relayout ] new-gesture
22 T{ key-down f f "LEFT" } [ dup board>> first LEFT move relayout ] new-gesture
23 board-init add-board ;
25 :: second-gadget ( -- gadget )
26 { 500 400 } init-board-gadget
27 board-init add-board ;
29 :: display-window ( -- )
32 { g1 g2 } horizontal 0 f <window> ! initalize two boards