]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/terrain/terrain.factor
GAME: syntax for defining game entry point with game-loop attributes
[factor.git] / extra / terrain / terrain.factor
index 655fee501128fdd31c2282e12f0d3ca8949e494c..adbeb9c441fa2fb7f062ea2d9f390a819fd7084b 100644 (file)
@@ -55,9 +55,6 @@ TUPLE: terrain-world < game-world
         float-4{ 0.0 0.0 0.0 1.0 } >>velocity
         VELOCITY-MODIFIER-NORMAL >>velocity-modifier ;
 
-M: terrain-world tick-interval-micros
-    drop 1000000 60 /i ;
-
 : frustum ( dim -- -x x -y y near far )
     dup first2 min v/n
     NEAR-PLANE FOV / v*n first2 [ [ neg ] keep ] bi@
@@ -290,20 +287,15 @@ M: terrain-world draw-world*
         ] with-gl-program ]
     } cleave gl-error ;
 
-M: terrain-world pref-dim* drop { 1024 768 } ;
-
-: terrain-window ( -- )
-    [
-        f T{ world-attributes
-            { world-class terrain-world }
-            { title "Terrain" }
-            { pixel-format-attributes {
-                windowed
-                double-buffered
-                T{ depth-bits { value 24 } }
-            } }
-            { grab-input? t }
-        } open-window
-    ] with-ui ;
-
-MAIN: terrain-window
+GAME: terrain-game {
+        { world-class terrain-world }
+        { title "Terrain" }
+        { pixel-format-attributes {
+            windowed
+            double-buffered
+            T{ depth-bits { value 24 } }
+        } }
+        { grab-input? t }
+        { pref-dim { 1024 768 } }
+        { tick-interval-micros $[ 1,000,000 60 /i ] }
+    }