1 ! Copyright (C) 2007, 2008 Alex Chapman
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors kernel opengl arrays sequences jamshred.log jamshred.player jamshred.sound jamshred.tunnel math math.constants math.vectors ;
6 TUPLE: jamshred sounds tunnel players running quit ;
8 : <jamshred> ( -- jamshred )
9 <sounds> <random-tunnel> "Player 1" pick <player>
10 2dup swap play-in-tunnel 1array f f jamshred boa ;
12 : jamshred-player ( jamshred -- player )
13 ! TODO: support more than one player
16 : jamshred-update ( jamshred -- )
18 jamshred-player update-player
21 : toggle-running ( jamshred -- )
25 [ jamshred-player moved ]
26 [ t >>running drop ] bi
29 : mouse-moved ( x-radians y-radians jamshred -- )
30 jamshred-player -rot turn-player ;
32 : units-per-full-roll ( -- n ) 50 ;
34 : jamshred-roll ( jamshred n -- )
35 [ jamshred-player ] dip 2 pi * * units-per-full-roll / roll-player ;
37 : mouse-scroll-x ( jamshred x -- ) jamshred-roll ;
39 : mouse-scroll-y ( jamshred y -- )
40 neg swap jamshred-player change-player-speed ;