1 USING: accessors colors gamelib.board gamelib.cell-object
2 gamelib.ui images.loader kernel literals opengl.textures
5 IN: gamelib.demos.sokoban.layouts
7 CONSTANT: player "vocab:gamelib/demos/sokoban/resources/CharR.png"
8 CONSTANT: wall "vocab:gamelib/demos/sokoban/resources/Wall_Brown.png"
9 CONSTANT: goal "vocab:gamelib/demos/sokoban/resources/Goal.png"
10 CONSTANT: light-crate "vocab:gamelib/demos/sokoban/resources/Crate_Yellow.png"
11 CONSTANT: dark-crate "vocab:gamelib/demos/sokoban/resources/CrateDark_Yellow.png"
13 TUPLE: crate-cell < cell-object image-path ;
15 M: crate-cell draw-cell-object*
16 rot [ image-path>> load-image ] dip <texture> draw-scaled-texture ;
18 :: make-crate ( image-path -- crate )
20 image-path crate-cell boa ;
22 : board-one ( gadget -- gadget )
25 { 2 2 } player add-to-cell
28 { 2 0 } { 3 0 } { 4 0 } { 5 0 } { 6 0 }
29 { 0 1 } { 1 1 } { 2 1 } { 6 1 }
31 { 0 3 } { 1 3 } { 2 3 } { 6 3 }
32 { 0 4 } { 2 4 } { 3 4 } { 6 4 }
33 { 0 5 } { 2 5 } { 6 5 } { 7 5 }
36 { 0 8 } { 1 8 } { 2 8 } { 3 8 } { 4 8 } { 5 8 } { 6 8 } { 7 8 }
42 { 1 6 } { 3 2 } { 4 3 } { 4 4 } { 4 6 } { 3 6 } { 5 6 }
43 } $ light-crate make-crate add-copy-to-cells
46 { 1 2 } { 5 3 } { 1 4 } { 4 5 } { 3 6 } { 6 6 } { 4 7 }
49 { } 1sequence add-board ;
52 : board-two ( gadget -- gadget )
55 { 11 8 } player add-to-cell
58 { 4 0 } { 5 0 } { 6 0 } { 7 0 } { 8 0 }
61 { 2 3 } { 3 3 } { 4 3 } { 8 3 } { 9 3 } { 10 3 }
63 { 0 5 } { 1 5 } { 2 5 } { 4 5 } { 6 5 } { 7 5 } { 8 5 } { 10 5 } { 16 5 } { 17 5 } { 18 5 } { 19 5 } { 20 5 } { 21 5 }
64 { 0 6 } { 4 6 } { 6 6 } { 7 6 } { 8 6 } { 10 6 } { 11 6 } { 12 6 } { 13 6 } { 14 6 } { 15 6 } { 16 6 } { 21 6 }
66 { 0 8 } { 1 8 } { 2 8 } { 3 8 } { 4 8 } { 6 8 } { 7 8 } { 8 8 } { 10 8 } { 12 8 } { 13 8 } { 14 8 } { 15 8 } { 16 8 } { 21 8 }
67 { 4 9 } { 10 9 } { 11 9 } { 12 9 } { 16 9 } { 17 9 } { 18 9 } { 19 9 } { 20 9 } { 21 9 }
68 { 4 10 } { 5 10 } { 6 10 } { 7 10 } { 8 10 } { 9 10 } { 10 10 }
78 { 5 2 } { 7 3 } { 5 4 } { 8 4 } { 5 7 } { 2 7 }
79 } $ light-crate make-crate add-copy-to-cells
86 : board-three ( gadget -- gadget )
89 { 1 1 } player add-to-cell
92 { 0 0 } { 1 0 } { 2 0 } { 3 0 } { 4 0 } { 5 0 } { 6 0 } { 7 0 }
99 { 0 7 } { 1 7 } { 2 7 } { 3 7 } { 4 7 } { 5 7 } { 6 7 } { 7 7 }
100 } $ wall add-to-cells
102 { 2 1 } $ light-crate make-crate add-to-cell
104 { 3 1 } $ goal add-to-cell