1 ! Copyright (C) 2007, 2008 Alex Chapman
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors arrays jamshred.player jamshred.sound
4 jamshred.tunnel kernel math math.constants sequences ;
7 TUPLE: jamshred sounds tunnel players running quit ;
9 : <jamshred> ( -- jamshred )
10 <sounds> <random-tunnel> "Player 1" pick <player>
11 2dup swap play-in-tunnel 1array f f jamshred boa ;
13 : jamshred-player ( jamshred -- player )
14 ! TODO: support more than one player
17 : jamshred-update ( jamshred -- )
19 jamshred-player update-player
22 : toggle-running ( jamshred -- )
26 [ jamshred-player moved ]
27 [ t >>running drop ] bi
30 : mouse-moved ( x-radians y-radians jamshred -- )
31 jamshred-player -rot turn-player ;
33 CONSTANT: units-per-full-roll 50
35 : jamshred-roll ( jamshred n -- )
36 [ jamshred-player ] dip 2 pi * * units-per-full-roll / roll-player ;
38 : mouse-scroll-x ( jamshred x -- ) jamshred-roll ;
40 : mouse-scroll-y ( jamshred y -- )
41 neg swap jamshred-player change-player-speed ;