]> gitweb.factorcode.org Git - factor.git/commitdiff
Finish renaming micros->nanos in game code, update libs
authorDoug Coleman <doug.coleman@gmail.com>
Sat, 22 May 2010 04:50:42 +0000 (23:50 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Sat, 22 May 2010 04:50:42 +0000 (23:50 -0500)
extra/chipmunk/demo/demo.factor
extra/fluids/fluids.factor
extra/game/debug/tests/tests.factor
extra/game/loop/loop-docs.factor
extra/game/worlds/worlds-docs.factor
extra/game/worlds/worlds.factor
extra/gpu/demos/bunny/bunny.factor
extra/gpu/demos/raytrace/raytrace.factor
extra/model-viewer/model-viewer.factor
extra/terrain/terrain.factor

index c110349db576e5dfbd43f91df18a490bf27f86da..61bb57dc7e9dd5de3e76cc6a5e9cbe0306df77d9 100644 (file)
@@ -144,7 +144,7 @@ M: chipmunk-world end-game-world
              { windowed double-buffered }
            }
            { pref-dim { 640 480 } }
-           { tick-interval-micros 16666 }
+           { tick-interval-nanos $[ 60 fps ] }
         }
         clone
         open-window
index f2d02b22a32eb15831f57fa8b40a170ee12f3a9c..68d20f681dcac00f26bbce7611c07a7b1c1146a8 100644 (file)
@@ -66,7 +66,7 @@ TUPLE: fluids-world < game-world
 SYMBOL: fluid
 
 : integrate ( world -- )
-    particles>> $[ 60 fps 1000000 /f ] integrate-particles! drop ;
+    particles>> $[ 60 fps 1,000,000,000 /f ] integrate-particles! drop ;
 
 : pause ( -- )
     fluid get [ not ] change-paused drop ;
@@ -108,7 +108,7 @@ GAME: fluids {
     { pixel-format-attributes {
         windowed double-buffered T{ depth-bits { value 24 } } } }
     { pref-dim { 1024 768 } }
-    { tick-interval-micros $[ 60 fps ] }
+    { tick-interval-nanos $[ 60 fps ] }
 } ;
 
 fluids-world H{
index 049aa2b4921c7f3dab46be1a8ec74a4efb7d27eb..817379bf575fe78e2411953470df129722e0b413 100644 (file)
@@ -62,7 +62,7 @@ GAME: run-tests {
         { grab-input? t }
         { use-game-input? t }
         { pref-dim { 1024 768 } }
-        { tick-interval-micros $[ 60 fps ] }
+        { tick-interval-nanos $[ 60 fps ] }
     } ;
 
 MAIN: run-tests
index b48f01cd82138197e7da2b05d31c7d65603e4f2b..1605c45284795ccab6db5241c145f46da237cf09 100644 (file)
@@ -3,24 +3,24 @@ USING: help.markup help.syntax kernel math ui.gadgets.worlds ;
 IN: game.loop
 
 HELP: fps
-{ $values { "fps" real } { "micros" integer } }
-{ $description "Converts a frames per second value into an interval length in microseconds." } ;
+{ $values { "fps" real } { "nanos" integer } }
+{ $description "Converts a frames per second value into an interval length in nanoseconds." } ;
 
 HELP: <game-loop>
 { $values
-    { "tick-interval-micros" integer } { "delegate" "a " { $link "game.loop-delegates" } }
+    { "tick-interval-nanos" integer } { "delegate" "a " { $link "game.loop-delegates" } }
     { "loop" game-loop }
 }
-{ $description "Constructs a new stopped " { $link game-loop } " object. When started, the game loop will call the " { $link tick* } " method on the " { $snippet "delegate" } " every " { $snippet "tick-interval-micros" } " microseconds, and " { $link draw* } " on the same delegate object as frequently as possible. The " { $link start-loop } " and " { $link stop-loop } " words start and stop the game loop."
+{ $description "Constructs a new stopped " { $link game-loop } " object. When started, the game loop will call the " { $link tick* } " method on the " { $snippet "delegate" } " every " { $snippet "tick-interval-nanos" } " nanoseconds, and " { $link draw* } " on the same delegate object as frequently as possible. The " { $link start-loop } " and " { $link stop-loop } " words start and stop the game loop."
 $nl
 "To initialize the game loop with separate tick and draw delegates, use " { $link <game-loop*> } "." } ;
 
 HELP: <game-loop*>
 { $values
-    { "tick-interval-micros" integer } { "tick-delegate" "a " { $link "game.loop-delegates" } } { "draw-delegate" "a " { $link "game.loop-delegates" } }
+    { "tick-interval-nanos" integer } { "tick-delegate" "a " { $link "game.loop-delegates" } } { "draw-delegate" "a " { $link "game.loop-delegates" } }
     { "loop" game-loop }
 }
-{ $description "Constructs a new stopped " { $link game-loop } " object. When started, the game loop will call the " { $link tick* } " method on the " { $snippet "tick-delegate" } " every " { $snippet "tick-interval-micros" } " microseconds, and " { $link draw* } " on the " { $snippet "draw-delegate" } " as frequently as possible. The " { $link start-loop } " and " { $link stop-loop } " words start and stop the game loop."
+{ $description "Constructs a new stopped " { $link game-loop } " object. When started, the game loop will call the " { $link tick* } " method on the " { $snippet "tick-delegate" } " every " { $snippet "tick-interval-nanos" } " nanoseconds, and " { $link draw* } " on the " { $snippet "draw-delegate" } " as frequently as possible. The " { $link start-loop } " and " { $link stop-loop } " words start and stop the game loop."
 $nl
 "The " { $link <game-loop> } " word provides a shorthand for initializing a game loop that uses the same object for the " { $snippet "tick-delegate" } " and " { $snippet "draw-delegate" } "." } ;
 
@@ -46,7 +46,7 @@ HELP: draw*
 { $values
     { "tick-slice" float } { "delegate" "a " { $link "game.loop-delegates" } }
 }
-{ $description "This generic word is called by a " { $link game-loop } " on its " { $snippet "draw-delegate" } " object in a tight loop while the game loop is running. The " { $snippet "tick-slice" } " value represents what fraction of the game loop's " { $snippet "tick-interval-micros" } " time period has passed since " { $link tick* } " was most recently called on the " { $snippet "tick-delegate" } "." } ;
+{ $description "This generic word is called by a " { $link game-loop } " on its " { $snippet "draw-delegate" } " object in a tight loop while the game loop is running. The " { $snippet "tick-slice" } " value represents what fraction of the game loop's " { $snippet "tick-interval-nanos" } " time period has passed since " { $link tick* } " was most recently called on the " { $snippet "tick-delegate" } "." } ;
 
 HELP: game-loop
 { $class-description "Objects of the " { $snippet "game-loop" } " class manage game loops. See " { $link "game.loop" } " for an overview of the game loop library. To construct a game loop, use " { $link <game-loop> } ". To start and stop a game loop, use the " { $link start-loop } " and " { $link stop-loop } " words."
@@ -83,7 +83,7 @@ HELP: tick*
 { $values
     { "delegate" "a " { $link "game.loop-delegates" } }
 }
-{ $description "This generic word is called by a " { $link game-loop } " on its " { $snippet "tick-delegate" } " object at regular intervals while the game loop is running. The game loop's " { $snippet "tick-interval-micros" } " attribute determines the number of microseconds between invocations of " { $snippet "tick*" } "." } ;
+{ $description "This generic word is called by a " { $link game-loop } " on its " { $snippet "tick-delegate" } " object at regular intervals while the game loop is running. The game loop's " { $snippet "tick-interval-nanos" } " attribute determines the number of nanoseconds between invocations of " { $snippet "tick*" } "." } ;
 
 { draw* tick* } related-words
 
@@ -93,7 +93,7 @@ ARTICLE: "game.loop-delegates" "Game loop delegate"
     tick*
     draw*
 }
-{ $snippet "tick*" } " will be called at a regular interval determined by the game loop's " { $snippet "tick-interval-micros" } " attribute on the tick delegate. " { $snippet "draw*" } " will be invoked on the draw delegate in a tight loop, updating as frequently as possible."
+{ $snippet "tick*" } " will be called at a regular interval determined by the game loop's " { $snippet "tick-interval-nanos" } " attribute on the tick delegate. " { $snippet "draw*" } " will be invoked on the draw delegate in a tight loop, updating as frequently as possible."
 $nl
 "It is possible to change the " { $snippet "tick-delegate" } " and " { $snippet "draw-delegate" } " slots of a game loop while it is running, for example, to use different delegates to control a game while it's in the menu, paused, or running the main game." ;
 
index c10ae4056130bd70c3133b29d6ce9a518828bc43..c169ec8b5dd05e42fc8a9886a45e6889aa84c659 100644 (file)
@@ -6,7 +6,7 @@ IN: game.worlds
 HELP: game-attributes
 { $class-description "Extends the " { $link world-attributes } " tuple class with extra attributes for " { $link game-world } "s:" }
 { $list
-{ { $snippet "tick-interval-micros" } " specifies the number of microseconds between consecutive calls to the world's " { $link tick-game-world } " method by the game loop. An integer greater than zero must be provided." }
+{ { $snippet "tick-interval-nanos" } " specifies the number of nanoseconds between consecutive calls to the world's " { $link tick-game-world } " method by the game loop. An integer greater than zero must be provided." }
 { { $snippet "use-game-input?" } " specifies whether the game world should initialize the " { $vocab-link "game.input" } " library for use by the game. False by default." }
 { { $snippet "use-audio-engine?" } " specifies whether the game world should manage an " { $link audio-engine } " instance. False by default." }
 { { $snippet "audio-engine-device" } " specifies the string name of the OpenAL device the audio engine, if any, should try to open. The default value of " { $link POSTPONE: f } " attempts to open the default OpenAL device." }
index bf05eddc71b589de6316aa5a5846b6fec2ae9e9f..380388b90cd9968997e3dda5a9529815ad06dfc9 100644 (file)
@@ -7,7 +7,7 @@ IN: game.worlds
 TUPLE: game-world < world
     game-loop
     audio-engine
-    { tick-interval-micros fixnum }
+    { tick-interval-nanos integer }
     { use-game-input? boolean }
     { use-audio-engine? boolean }
     { audio-engine-device initial: f }
@@ -44,7 +44,7 @@ PRIVATE>
 M: game-world begin-world
     dup use-game-input?>> [ open-game-input ] when
     dup use-audio-engine?>> [ dup open-game-audio-engine >>audio-engine ] when
-    dup [ tick-interval-micros>> ] [ ] bi <game-loop>
+    dup [ tick-interval-nanos>> ] [ ] bi <game-loop>
     [ >>game-loop begin-game-world ] keep start-loop ;
 
 M: game-world end-world
@@ -54,7 +54,7 @@ M: game-world end-world
     [ use-game-input?>> [ close-game-input ] when ] tri ;
 
 TUPLE: game-attributes < world-attributes
-    { tick-interval-micros fixnum }
+    { tick-interval-nanos fixnum }
     { use-game-input? boolean initial: f }
     { use-audio-engine? boolean initial: f }
     { audio-engine-device initial: f }
@@ -62,7 +62,7 @@ TUPLE: game-attributes < world-attributes
 
 M: game-world apply-world-attributes
     {
-        [ tick-interval-micros>> >>tick-interval-micros ]
+        [ tick-interval-nanos>> >>tick-interval-nanos ]
         [ use-game-input?>> >>use-game-input? ]
         [ use-audio-engine?>> >>use-audio-engine? ]
         [ audio-engine-device>> >>audio-engine-device ]
index ae5757efcde715e81084f91c5a1e3bf49548bad5..28deff905c39ed1924d7613ed4f2b8721b24f00d 100644 (file)
@@ -311,5 +311,5 @@ GAME: bunny-game {
         { grab-input? t }
         { use-game-input? t }
         { pref-dim { 1024 768 } }
-        { tick-interval-micros $[ 60 fps ] }
+        { tick-interval-nanos $[ 60 fps ] }
     } ;
index bdd1b51deb28cbc3d948ca73ee7f81c4db8aa8ab..9828c97aa77d200cfbf8dbf3d20c21eabb55043a 100644 (file)
@@ -126,5 +126,5 @@ GAME: raytrace-game {
         { use-game-input? t }
         { use-audio-engine? t }
         { pref-dim { 1024 768 } }
-        { tick-interval-micros $[ 60 fps ] }
+        { tick-interval-nanos $[ 60 fps ] }
     } ;
index 93bb0bd836e1d66020e1a03ee0f80dd27bbdd0a6..b78862d225fa10bf784d9f9af6be06dd22525e9d 100644 (file)
@@ -211,7 +211,7 @@ M: model-world apply-world-attributes
              { windowed double-buffered }
            }
            { pref-dim { 1024 768 } }
-           { tick-interval-micros 16666 }
+           { tick-interval-nanos $[ 60 fps ] }
            { use-game-input? t }
            { model-path model-path }
         }
index d8bc90bf737297991ecc8ce385801b1bd0794a36..e1051cf21b8b52d4d0d8bada9eb4bf3f0f566782 100644 (file)
@@ -298,5 +298,5 @@ GAME: terrain-game {
         { use-game-input? t }
         { grab-input? t }
         { pref-dim { 1024 768 } }
-        { tick-interval-micros $[ 60 fps ] }
+        { tick-interval-nanos $[ 60 fps ] }
     } ;