]> gitweb.factorcode.org Git - factor.git/blob - apps/lindenmayer/camera-slate.factor
294a54f8b8141a19b24c4ba5e81514a2eb44729e
[factor.git] / apps / lindenmayer / camera-slate.factor
1
2 USING: kernel namespaces generic math gadgets vars slate turtle turtle-camera ;
3
4 IN: camera-slate
5
6 TUPLE: camera-slate ;
7
8 C: camera-slate ( -- 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
43   { T{ key-down f f "1" }
44     [ slate-ns
45       [
46         [ position> norm reset-turtle 90 turn-left step-turtle 180 turn-left ]
47         camera> with-turtle .slate
48       ] bind
49     ] }
50   { T{ key-down f f "2" }
51     [ slate-ns
52       [
53         [ position> norm reset-turtle 90 pitch-up step-turtle 180 pitch-down ]
54         camera> with-turtle .slate
55       ] bind
56     ] }
57   { T{ key-down f f "3" }
58     [ slate-ns
59       [
60         [ position> norm reset-turtle step-turtle 180 turn-left ]
61         camera> with-turtle .slate
62       ] bind
63     ] }
64
65 { T{ key-down f f "4" }
66     [ slate-ns
67       [
68         [ position> norm
69           reset-turtle 45 turn-left 45 pitch-up step-turtle 180 turn-left ]
70         camera> with-turtle .slate
71       ] bind
72     ] }
73
74 } set-gestures