]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/jamshred/jamshred.factor
mason: move alignment to mason.css, right align but-last columns in table body
[factor.git] / extra / jamshred / jamshred.factor
index ce53fefcf5cb49e1e59898dece7d724bf61cd8dc..3b653fd8e1a979b138d19f48beddab1d77690e81 100644 (file)
@@ -1,9 +1,9 @@
 ! Copyright (C) 2007, 2008 Alex Chapman
-! See http://factorcode.org/license.txt for BSD license.
+! See https://factorcode.org/license.txt for BSD license.
 USING: accessors arrays calendar jamshred.game jamshred.gl
-jamshred.player jamshred.log kernel math math.constants
-math.rectangles math.vectors namespaces sequences threads ui
-ui.backend ui.gadgets ui.gadgets.worlds ui.gestures ui.render ;
+jamshred.player kernel math math.constants math.vectors
+namespaces sequences threads ui ui.gadgets ui.gadgets.worlds
+ui.gestures ui.render ;
 IN: jamshred
 
 TUPLE: jamshred-gadget < gadget { jamshred jamshred } last-hand-loc ;
@@ -26,7 +26,7 @@ M: jamshred-gadget draw-gadget* ( gadget -- )
     ] [
         [ jamshred>> jamshred-update ]
         [ relayout-1 ]
-        [ 100 milliseconds sleep jamshred-loop ] tri 
+        [ 100 milliseconds sleep jamshred-loop ] tri
     ] if ;
 
 M: jamshred-gadget graft* ( gadget -- )
@@ -43,11 +43,11 @@ M: jamshred-gadget ungraft* ( gadget -- )
     / pi 4 * * ; ! 2 / / pi 2 * * ;
 
 : x>radians ( x gadget -- theta )
-    #! translate motion of x pixels to an angle
+    ! translate motion of x pixels to an angle
     dim>> first pix>radians neg ;
 
 : y>radians ( y gadget -- theta )
-    #! translate motion of y pixels to an angle
+    ! translate motion of y pixels to an angle
     dim>> second pix>radians ;
 
 : (handle-mouse-motion) ( jamshred-gadget mouse-motion -- )
@@ -57,8 +57,8 @@ M: jamshred-gadget ungraft* ( gadget -- )
 : handle-mouse-motion ( jamshred-gadget -- )
     hand-loc get [
         over last-hand-loc>> [
-            v- (handle-mouse-motion) 
-        ] [ 2drop ] if* 
+            v- (handle-mouse-motion)
+        ] [ 2drop ] if*
     ] 2keep >>last-hand-loc drop ;
 
 : handle-mouse-scroll ( jamshred-gadget -- )
@@ -77,6 +77,7 @@ jamshred-gadget H{
     { T{ key-down f f "DOWN" } [ jamshred>> jamshred-player -1 swap change-player-speed ] }
     { T{ key-down f f "LEFT" } [ jamshred>> 1 jamshred-roll ] }
     { T{ key-down f f "RIGHT" } [ jamshred>> -1 jamshred-roll ] }
+    { T{ key-down f f "ESC" } [ quit ] }
     { T{ key-down f f "q" } [ quit ] }
     { motion [ handle-mouse-motion ] }
     { mouse-scroll [ handle-mouse-scroll ] }