]> gitweb.factorcode.org Git - factor.git/blob - contrib/lindenmayer/camera-slate.factor
5bbf9be44840b1ea024ee2a31129391dae4f1ad1
[factor.git] / contrib / lindenmayer / camera-slate.factor
1
2 USING: kernel namespaces generic gadgets vars slate turtle turtle-camera ;
3
4 IN: camera-slate
5
6 TUPLE: camera-slate ;
7
8 C: camera-slate ( -- ) <slate> over set-delegate ;
9
10 VAR: camera
11
12 camera-slate H{
13   { T{ key-down f f "LEFT" }
14     [ slate-ns [ [ 5 turn-left ] camera> with-turtle .slate ] bind ] }
15   { T{ key-down f f "RIGHT" }
16     [ slate-ns [ [ 5 turn-right ] camera> with-turtle .slate ] bind ] }
17   { T{ key-down f f "UP" }
18     [ slate-ns [ [ 5 pitch-down ] camera> with-turtle .slate ] bind ] }
19   { T{ key-down f f "DOWN" }
20     [ slate-ns [ [ 5 pitch-up ] camera> with-turtle .slate ] bind ] }
21   { T{ key-down f f "LEFT" }
22     [ slate-ns [ [ 5 turn-left ] camera> with-turtle .slate ] bind ] }
23
24   { T{ key-down f f "a" }
25     [ slate-ns [ [ 1 step-turtle ] camera> with-turtle .slate ] bind ] }
26   { T{ key-down f f "z" }
27     [ slate-ns [ [ -1 step-turtle ] camera> with-turtle .slate ] bind ] }
28
29   { T{ key-down f f "q" }
30     [ slate-ns [ [ 5 roll-left ] camera> with-turtle .slate ] bind ] }
31   { T{ key-down f f "w" }
32     [ slate-ns [ [ 5 roll-right ] camera> with-turtle .slate ] bind ] }
33
34   { T{ key-down f { A+ } "LEFT" }
35     [ slate-ns [ [ 1 strafe-left ] camera> with-turtle .slate ] bind ] }
36   { T{ key-down f { A+ } "RIGHT" }
37     [ slate-ns [ [ 1 strafe-right ] camera> with-turtle .slate ] bind ] }
38   { T{ key-down f { A+ } "UP" }
39     [ slate-ns [ [ 1 strafe-up ] camera> with-turtle .slate ] bind ] }
40   { T{ key-down f { A+ } "DOWN" }
41     [ slate-ns [ [ 1 strafe-down ] camera> with-turtle .slate ] bind ] }
42 } set-gestures