]> gitweb.factorcode.org Git - factor.git/blob - extra/gamelib/demos/sokoban/layouts/layouts.factor
gamelib.demos.sokoban: removing unused resources
[factor.git] / extra / gamelib / demos / sokoban / layouts / layouts.factor
1 USING: accessors colors gamelib.board gamelib.cell-object
2 gamelib.ui images.loader kernel literals opengl.textures
3 sequences namespaces ;
4
5 IN: gamelib.demos.sokoban.layouts
6
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"
12
13 TUPLE: crate-cell < cell-object image-path ;
14
15 M: crate-cell draw-cell-object* 
16     rot [ image-path>> load-image ] dip <texture> draw-scaled-texture ;
17
18 :: make-crate ( image-path -- crate )
19     crate-cell new
20     image-path crate-cell boa ;
21
22 : board-one ( gadget -- gadget )
23     8 9 make-board
24
25     { 2 2 } player add-to-cell
26
27     {
28                         { 2 0 } { 3 0 } { 4 0 } { 5 0 } { 6 0 }
29         { 0 1 } { 1 1 } { 2 1 }                         { 6 1 }
30         { 0 2 }                                         { 6 2 }
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 }
34         { 0 6 }                                                 { 7 6 }
35         { 0 7 }                                                 { 7 7 }
36         { 0 8 } { 1 8 } { 2 8 } { 3 8 } { 4 8 } { 5 8 } { 6 8 } { 7 8 }
37
38     } $ wall add-to-cells
39
40     { 
41
42         { 1 6 } { 3 2 } { 4 3 } { 4 4 } { 4 6 } { 3 6 } { 5 6 }
43     } $ light-crate make-crate add-copy-to-cells
44
45     {
46         { 1 2 } { 5 3 } { 1 4 } { 4 5 } { 3 6 } { 6 6 } { 4 7 } 
47     } $ goal add-to-cells 
48     
49     { } 1sequence add-board ;
50
51
52 : board-two ( gadget -- gadget )
53     22 11 make-board
54     
55     { 11 8 } player add-to-cell
56
57     {
58                                         { 4 0 } { 5 0 } { 6 0 } { 7 0 } { 8 0 }
59                                         { 4 1 }                         { 8 1 }
60                                         { 4 2 }                         { 8 2 }
61                         { 2 3 } { 3 3 } { 4 3 }                         { 8 3 } { 9 3 } { 10 3 }
62                         { 2 4 }                                                         { 10 4 }
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 }
65         { 0 7 }                                                                                                                                                                            { 21 7 }
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 }  
69     } $ wall add-to-cells
70     
71     {
72         { 19 6 } { 20 6 }
73         { 19 7 } { 20 7 }
74         { 19 8 } { 20 8 }
75     } $ goal add-to-cells
76
77     { 
78         { 5 2 } { 7 3 } { 5 4 } { 8 4 } { 5 7 } { 2 7 }
79     } $ light-crate make-crate add-copy-to-cells
80
81     { } 1sequence 
82
83     add-board ;
84
85
86 : board-three ( gadget -- gadget )
87     8 8 make-board
88     
89     { 1 1 } player add-to-cell
90
91     {
92         { 0 0 } { 1 0 } { 2 0 } { 3 0 } { 4 0 } { 5 0 } { 6 0 } { 7 0 }
93         { 0 1 }                                                 { 7 1 }
94         { 0 2 }                                                 { 7 2 }
95         { 0 3 }                                                 { 7 3 }
96         { 0 4 }                                                 { 7 4 }
97         { 0 5 }                                                 { 7 5 }
98         { 0 6 }                                                 { 7 6 }
99         { 0 7 } { 1 7 } { 2 7 } { 3 7 } { 4 7 } { 5 7 } { 6 7 } { 7 7 }
100     } $ wall add-to-cells
101
102     { 2 1 } $ light-crate make-crate add-to-cell
103
104     { 3 1 } $ goal add-to-cell
105
106     { } 1sequence 
107
108     add-board ;