]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'master' of git://github.com/slavapestov/factor
authorerikc <erikcharlebois@gmail.com>
Wed, 20 Jan 2010 03:31:44 +0000 (19:31 -0800)
committererikc <erikcharlebois@gmail.com>
Wed, 20 Jan 2010 03:31:44 +0000 (19:31 -0800)
12 files changed:
basis/ui/gadgets/worlds/worlds.factor
extra/audio/engine/engine.factor
extra/game/worlds/worlds-docs.factor
extra/game/worlds/worlds.factor
extra/gpu/demos/bunny/bunny.factor
extra/gpu/demos/raytrace/green-ball.aiff [new file with mode: 0644]
extra/gpu/demos/raytrace/mirror-ball.aiff [new file with mode: 0644]
extra/gpu/demos/raytrace/raytrace.factor
extra/gpu/demos/raytrace/red-ball.aiff [new file with mode: 0644]
extra/gpu/demos/raytrace/yellow-ball.aiff [new file with mode: 0644]
extra/gpu/util/wasd/wasd.factor
extra/terrain/terrain.factor

index 8a22107f3a0d187bad87e78b24c42238dc334dcb..7e54b823e8ebc3e814018d1d20df31788f02b582 100644 (file)
@@ -125,7 +125,8 @@ M: world request-focus-on ( child gadget -- )
     [ T{ rgba f 0.0 0.0 0.0 0.0 } ]
     [ T{ rgba f 1.0 1.0 1.0 1.0 } ] if ;
 
-: apply-world-attributes ( world attributes -- world )
+GENERIC# apply-world-attributes 1 ( world attributes -- world )
+M: world apply-world-attributes
     {
         [ title>> >>title ]
         [ status>> >>status ]
index 6caff51ee32b7fabe52294fb5303a75c35c41a62..176fc3c3058104bee953b271eeb930b49a59641a 100644 (file)
@@ -10,12 +10,16 @@ TUPLE: audio-source
     { position initial: { 0.0 0.0 0.0 } }
     { gain float initial: 1.0 }
     { velocity initial: { 0.0 0.0 0.0 } }
-    { relative? boolean initial: f } ;
+    { relative? boolean initial: f }
+    { distance float initial: 1.0 }
+    { rolloff float initial: 1.0 } ;
 
 TUPLE: audio-orientation
     { forward initial: { 0.0 0.0 -1.0 } }
     { up initial: { 0.0 1.0 0.0 } } ;
 
+C: <audio-orientation> audio-orientation
+
 : orientation>float-array ( orientation -- float-array )
     [ forward>> first3 ]
     [ up>> first3 ] bi 6 float-array{ } nsequence ; inline
@@ -26,6 +30,32 @@ TUPLE: audio-listener
     { velocity initial: { 0.0 0.0 0.0 } }
     { orientation initial: T{ audio-orientation } } ;
 
+GENERIC: audio-position ( source/listener -- position )
+GENERIC: audio-gain ( source/listener -- gain )
+GENERIC: audio-velocity ( source/listener -- velocity )
+GENERIC: audio-relative? ( source -- relative? )
+GENERIC: audio-distance ( source -- distance )
+GENERIC: audio-rolloff ( source -- rolloff )
+GENERIC: audio-orientation ( listener -- orientation )
+
+M: object audio-position drop { 0.0 0.0 0.0 } ; inline
+M: object audio-gain drop 1.0 ; inline
+M: object audio-velocity drop { 0.0 0.0 0.0 } ; inline
+M: object audio-relative? drop f ; inline
+M: object audio-distance drop 1.0 ; inline
+M: object audio-rolloff drop 1.0 ; inline
+M: object audio-orientation drop T{ audio-orientation } ; inline
+
+M: audio-source audio-position position>> ; inline
+M: audio-source audio-gain gain>> ; inline
+M: audio-source audio-velocity velocity>> ; inline
+M: audio-source audio-relative? relative?>> ; inline
+
+M: audio-listener audio-position position>> ; inline
+M: audio-listener audio-gain gain>> ; inline
+M: audio-listener audio-velocity velocity>> ; inline
+M: audio-listener audio-orientation orientation>> ; inline
+
 TUPLE: audio-engine < disposable
     { voice-count integer }
     { buffer-size integer }
@@ -33,7 +63,7 @@ TUPLE: audio-engine < disposable
     { al-device c-ptr }
     { al-context c-ptr }
     al-sources
-    { listener audio-listener }
+    listener
     { next-source integer }
     clips
     update-alarm ;
@@ -41,7 +71,7 @@ TUPLE: audio-engine < disposable
 TUPLE: audio-clip < disposable
     { audio-engine audio-engine }
     { audio audio }
-    { source audio-source }
+    source
     { loop? boolean }
     { al-source integer }
     { al-buffers uint-array }
@@ -152,18 +182,20 @@ ERROR: audio-context-not-available device-name ;
 
 : update-listener ( audio-engine -- )
     listener>> {
-        [ AL_POSITION swap position>> first3 alListener3f ]
-        [ AL_GAIN swap gain>> alListenerf ]
-        [ AL_VELOCITY swap velocity>> first3 alListener3f ]
-        [ AL_ORIENTATION swap orientation>> orientation>float-array alListenerfv ]
+        [ AL_POSITION swap audio-position first3 alListener3f ]
+        [ AL_GAIN swap audio-gain alListenerf ]
+        [ AL_VELOCITY swap audio-velocity first3 alListener3f ]
+        [ AL_ORIENTATION swap audio-orientation orientation>float-array alListenerfv ]
     } cleave ;
 
 : update-source ( audio-clip -- )
     [ al-source>> ] [ source>> ] bi {
-        [ AL_POSITION swap position>> first3 alSource3f ]
-        [ AL_GAIN swap gain>> alSourcef ]
-        [ AL_VELOCITY swap velocity>> first3 alSource3f ]
-        [ AL_SOURCE_RELATIVE swap relative?>> c:>c-bool alSourcei ]
+        [ AL_POSITION swap audio-position first3 alSource3f ]
+        [ AL_GAIN swap audio-gain alSourcef ]
+        [ AL_VELOCITY swap audio-velocity first3 alSource3f ]
+        [ AL_SOURCE_RELATIVE swap audio-relative? c:>c-bool alSourcei ]
+        [ AL_REFERENCE_DISTANCE swap audio-distance alSourcef ]
+        [ AL_ROLLOFF_FACTOR swap audio-rolloff alSourcef ]
     } 2cleave ;
 
 :: update-audio-clip ( audio-clip -- )
@@ -179,8 +211,8 @@ ERROR: audio-context-not-available device-name ;
         ] times
     ] if ;
 
-: clip-sources ( clips -- length sources )
-    [ length ] [ [ source>> ] uint-array{ } map-as ] bi ;
+: clip-al-sources ( clips -- length sources )
+    [ length ] [ [ al-source>> ] uint-array{ } map-as ] bi ;
 
 PRIVATE>
 
@@ -263,7 +295,7 @@ M: audio-clip dispose*
 
 : play-clips ( audio-clips -- )
     [ [ update-source ] each ]
-    [ clip-sources alSourcePlayv ] bi ;
+    [ clip-al-sources alSourcePlayv ] bi ;
 
 : <audio-clip> ( audio-engine audio source loop? -- audio-clip/f )
     (audio-clip) dup play-clip ;
@@ -272,19 +304,19 @@ M: audio-clip dispose*
     al-source>> alSourcePause ;
 
 : pause-clips ( audio-clip -- )
-    clip-sources alSourcePausev ;
+    clip-al-sources alSourcePausev ;
 
 : stop-clip ( audio-clip -- )
     dispose ;
 
 : stop-clips ( audio-clip -- )
-    [ clip-sources alSourceStopv ]
+    [ clip-al-sources alSourceStopv ]
     [ [ dispose ] each ] bi ;
 
 : update-audio ( audio-engine -- )
     {
         [ make-engine-current ]
         [ update-listener ]
-        [ clips>> [ update-audio-clip ] each ]
+        [ clips>> clone [ update-audio-clip ] each ]
     } cleave ;
 
index faa21a18dc061b6d05f163de093ddcc9f0a4515f..75aed4dbdad638aa049ebb529302123ad95d3e53 100644 (file)
@@ -1,50 +1,54 @@
 ! (c)2009 Joe Groff bsd license
-USING: game.loop help.markup help.syntax kernel math method-chains
+USING: audio.engine game.loop help.markup help.syntax kernel math method-chains
 ui ui.gadgets.worlds words ;
 IN: game.worlds
 
-HELP: GAME:
-{ $syntax """GAME: word { attributes }
-    attribute-code ;""" }
-{ $description "Similar to " { $link POSTPONE: MAIN-WINDOW: } ", defines a main entry point " { $snippet "word" } " for the current vocabulary that opens a UI window with the provided " { $snippet "attributes" } ". In addition to the standard " { $link world-attributes } ", additional " { $link game-attributes } " can be specified to specify game-specific attributes. Unlike " { $link POSTPONE: MAIN-WINDOW: } ", the " { $snippet "attributes" } " for " { $snippet "GAME:" } " must provide values for the " { $snippet "world-class" } " and " { $snippet "tick-interval-micros" } " slots." } ;
-
 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* } " method by the game loop." }
+{ { $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 "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." }
+{ { $snippet "audio-engine-voice-count" } " determines the number of independent voices the audio engine will make available. This determines how many individual audio clips can play simultaneously. This cannot exceed the OpenAL implementation's limit on supported voices." }
+{ { $snippet "audio-engine-buffer-size" } " determines the size in bytes of the audio buffers the audio engine will stream to the sound card." }
+{ { $snippet "audio-engine-buffer-count" } " determines the number of buffers the audio engine will allocate per audio clip played." }
 } ;
 
 HELP: game-world
-{ $class-description "A subclass of " { $link world } " that automatically sets up and manages connections to the " { $vocab-link "game.loop" } " and " { $vocab-link "game.input" } " libraries. It does this by providing methods on " { $link begin-world } ", " { $link end-world } ", and " { $link draw* } ". Subclasses can provide their own world setup and teardown code by adding methods to the " { $link begin-game-world } " and " { $link end-game-world } " generic words." } ;
+{ $class-description "A subclass of " { $link world } " that automatically sets up and manages connections to the " { $vocab-link "game.loop" } ", " { $vocab-link "game.input" } ", and " { $vocab-link "audio.engine" } " libraries. It does this by providing methods on " { $link begin-world } ", " { $link end-world } ", and " { $link draw* } ". Subclasses can provide their own world setup and teardown code by adding methods to the " { $link begin-game-world } " and " { $link end-game-world } " generic words."
+$nl
+"The game-world tuple has the following publicly accessible slots:"
+{ $list
+{ { $snippet "game-loop" } " contains the " { $link game-loop } " instance managed by the game world. If the world is inactive, this slot will contain " { $link POSTPONE: f } "." }
+{ { $snippet "audio-engine" } " contains the " { $link audio-engine } " instance managed by the game world. If the world is inactive, or the " { $snippet "use-audio-engine?" } " slot of the " { $link game-attributes } " object used to initialize the world was false, this slot will contain " { $link POSTPONE: f } "." }
+} } ;
 
 HELP: begin-game-world
 { $values { "world" game-world } }
-{ $description "This generic word is called by the " { $link begin-world } " method for " { $link game-world } " subclasses immediately before the game world starts the game loop." } ;
+{ $description "This generic word is called by the " { $link begin-world } " method for " { $link game-world } " subclasses immediately before the game world starts the game loop. If the game world has an " { $link audio-engine } ", it will be initialized and started before " { $snippet "begin-game-world" } " is called." } ;
 
 HELP: end-game-world
 { $values { "world" game-world } }
 { $description "This generic word is called by the " { $link end-world } " method for " { $link game-world } " subclasses immediately after the game world stops the game loop." } ;
 
-{ game-world begin-game-world end-game-world } related-words
+HELP: tick-game-world
+{ $values { "world" game-world } }
+{ $description "This generic word is called by the " { $link tick* } " method for " { $link game-world } " subclasses every time the game loop's tick interval occurs." } ;
 
-HELP: tick-interval-micros
-{ $values
-    { "world" game-world }
-    { "micros" integer }
-}
-{ $description "Subclasses of " { $link game-world } " can override this class to specify the number of microseconds between consecutive calls to the game world's " { $link tick* } " method by the game loop. Using the " { $link POSTPONE: GAME: } " syntax will define this method for you." } ;
+{ game-world begin-game-world end-game-world tick-game-world } related-words
 
 ARTICLE: "game.worlds" "Game worlds"
-"The " { $vocab-link "game.worlds" } " vocabulary provides a " { $link world } " subclass that integrates with " { $vocab-link "game.loop" } " and " { $vocab-link "game.input" } " to quickly provide game infrastructure." 
+"The " { $vocab-link "game.worlds" } " vocabulary provides a " { $link world } " subclass that integrates with " { $vocab-link "game.loop" } " and optionally " { $vocab-link "game.input" } " and " { $vocab-link "audio.engine" } " to quickly provide game infrastructure." 
 { $subsections
     game-world
     game-attributes
-    POSTPONE: GAME:
 }
-"Subclasses of " { $link game-world } " can provide their own setup and teardown code by providing methods for these generic words:"
+"Subclasses of " { $link game-world } " can provide their own setup, teardown, and update code by providing methods for these generic words:"
 { $subsections
     begin-game-world
     end-game-world
+    tick-game-world
 } ;
 
 ABOUT: "game.worlds"
index d624a1b41e80f44837885ee0aae137507dbc1a75..cf75d37b39c0c696605ed8482e0fc749a854e509 100644 (file)
@@ -1,71 +1,86 @@
 ! (c)2009 Joe Groff bsd license
 USING: accessors combinators fry game.input game.loop generic kernel math
 parser sequences ui ui.gadgets ui.gadgets.worlds ui.gestures threads
-words ;
+words audio.engine destructors ;
 IN: game.worlds
 
 TUPLE: game-world < world
     game-loop
+    audio-engine
+    { tick-interval-micros fixnum }
+    { use-game-input? boolean }
+    { use-audio-engine? boolean }
+    { audio-engine-device initial: f }
+    { audio-engine-voice-count initial: 16 }
+    { audio-engine-buffer-size initial: 8192 }
+    { audio-engine-buffer-count initial: 2 }
     { tick-slice float initial: 0.0 } ;
 
-GENERIC: tick-interval-micros ( world -- micros )
-
 GENERIC: begin-game-world ( world -- )
 M: object begin-game-world drop ;
 
 GENERIC: end-game-world ( world -- )
 M: object end-game-world drop ;
 
+GENERIC: tick-game-world ( world -- )
+M: object tick-game-world drop ;
+
+M: game-world tick*
+    [ tick-game-world ]
+    [ audio-engine>> [ update-audio ] when* ] bi ;
+
 M: game-world draw*
     swap >>tick-slice relayout-1 yield ;
 
+<PRIVATE
+
+: open-game-audio-engine ( game-world -- audio-engine )
+    {
+        [ audio-engine-device>> ]
+        [ audio-engine-voice-count>> ]
+        [ audio-engine-buffer-size>> ]
+        [ audio-engine-buffer-count>> ]
+    } cleave <audio-engine>
+    [ start-audio* ] keep ; inline
+
+PRIVATE>
+
 M: game-world begin-world
-    open-game-input 
+    dup use-game-input?>> [ open-game-input ] when
+    dup use-audio-engine?>> [ dup open-game-audio-engine >>audio-engine ] when
     dup begin-game-world
-    dup [ tick-interval-micros ] [ ] bi <game-loop> [ >>game-loop ] keep start-loop
+    dup [ tick-interval-micros>> ] [ ] bi <game-loop> [ >>game-loop ] keep start-loop
     drop ;
 
 M: game-world end-world
     [ [ stop-loop ] when* f ] change-game-loop
-    end-game-world
-    close-game-input ;
+    [ end-game-world ]
+    [ audio-engine>> [ dispose ] when* ]
+    [ use-game-input?>> [ close-game-input ] when ] tri ;
 
 TUPLE: game-attributes < world-attributes
-    { tick-interval-micros fixnum read-only } ;
+    { tick-interval-micros fixnum }
+    { use-game-input? boolean initial: f }
+    { use-audio-engine? boolean initial: f }
+    { audio-engine-device initial: f }
+    { audio-engine-voice-count initial: 16 }
+    { audio-engine-buffer-size initial: 8192 }
+    { audio-engine-buffer-count initial: 2 } ;
 
-<PRIVATE
-
-: verify-game-attributes ( attributes -- )
+M: game-world apply-world-attributes
     {
-        [
-            world-class>> { f world } member?
-            [ "GAME: must be given a custom world-class" throw ] when
-        ]
-        [
-            tick-interval-micros>> 0 <=
-            [ "GAME: must be given a nonzero tick-interval-micros" throw ] when
-        ]
+        [ tick-interval-micros>> >>tick-interval-micros ]
+        [ use-game-input?>> >>use-game-input? ]
+        [ use-audio-engine?>> >>use-audio-engine? ]
+        [ audio-engine-device>> >>audio-engine-device ]
+        [ audio-engine-voice-count>> >>audio-engine-voice-count ]
+        [ audio-engine-buffer-size>> >>audio-engine-buffer-size ]
+        [ audio-engine-buffer-count>> >>audio-engine-buffer-count ]
+        [ call-next-method ]
     } cleave ;
 
-: define-game-tick-interval-micros ( attributes -- )
-    [ world-class>> \ tick-interval-micros create-method ]
-    [ tick-interval-micros>> '[ drop _ ] ] bi
-    define ;
-
-: define-game-methods ( attributes -- )
-    {
-        [ verify-game-attributes ]
-        [ define-game-tick-interval-micros ]
-    } cleave ;
-
-: define-game ( word attributes quot -- )
-    [ define-main-window ]
-    [ drop nip define-game-methods ] 3bi ;
-
-PRIVATE>
-
 SYNTAX: GAME:
     CREATE
     game-attributes parse-main-window-attributes
     parse-definition
-    define-game ;
+    define-main-window ;
index f56be88c78ca2659647c8d15c0381707f9d29830..b2f619c3d1cd287d877475d5a2b93b188d4c61b3 100644 (file)
@@ -306,6 +306,7 @@ GAME: bunny-game {
             T{ depth-bits { value 24 } }
         } }
         { grab-input? t }
+        { use-game-input? t }
         { pref-dim { 1024 768 } }
         { tick-interval-micros $[ 60 fps ] }
     } ;
diff --git a/extra/gpu/demos/raytrace/green-ball.aiff b/extra/gpu/demos/raytrace/green-ball.aiff
new file mode 100644 (file)
index 0000000..a7c0372
Binary files /dev/null and b/extra/gpu/demos/raytrace/green-ball.aiff differ
diff --git a/extra/gpu/demos/raytrace/mirror-ball.aiff b/extra/gpu/demos/raytrace/mirror-ball.aiff
new file mode 100644 (file)
index 0000000..a1cd163
Binary files /dev/null and b/extra/gpu/demos/raytrace/mirror-ball.aiff differ
index 0b44ac2e23e83ac023a3b21e078f90a9fb1a828e..54912544f1defa4ed9da9a497b208cb3ce8c5877 100644 (file)
@@ -1,9 +1,9 @@
 ! (c)2009 Joe Groff bsd license
 USING: accessors arrays combinators.tuple game.loop game.worlds
 generalizations gpu gpu.render gpu.shaders gpu.util gpu.util.wasd
-kernel literals math math.matrices math.order math.vectors
+kernel literals math math.libm math.matrices math.order math.vectors
 method-chains sequences ui ui.gadgets ui.gadgets.worlds
-ui.pixel-formats ;
+ui.pixel-formats audio.engine audio.loader locals ;
 IN: gpu.demos.raytrace
 
 GLSL-SHADER-FILE: raytrace-vertex-shader vertex-shader "raytrace.v.glsl"
@@ -49,6 +49,9 @@ TUPLE: raytrace-world < wasd-world
     [ [ axis>> ] [ theta>> ] bi rotation-matrix4 ]
     [ home>> ] bi m.v ;
 
+M: sphere audio-position sphere-center ; inline
+M: sphere audio-distance radius>> fsqrt 2.0 * ; inline
+
 : <sphere-uniforms> ( world -- uniforms )
     [ wasd-mv-inv-matrix ]
     [ fov>> ]
@@ -69,19 +72,36 @@ CONSTANT: initial-spheres {
     T{ sphere f { 1.0 0.0  0.0 } {  0.0 5.0 0.0 } 0.025 1.0 { 1.0 1.0 0.0 1.0 } }
 }
 
+:: set-up-audio ( world -- )
+    world audio-engine>> :> audio-engine
+    world spheres>> :> spheres
+
+    audio-engine world >>listener update-audio
+
+    audio-engine "vocab:gpu/demos/raytrace/mirror-ball.aiff" read-audio
+    spheres first t (audio-clip)
+    audio-engine "vocab:gpu/demos/raytrace/red-ball.aiff" read-audio
+    spheres second t (audio-clip)
+    audio-engine "vocab:gpu/demos/raytrace/green-ball.aiff" read-audio
+    spheres third t (audio-clip)
+    audio-engine "vocab:gpu/demos/raytrace/yellow-ball.aiff" read-audio
+    spheres fourth t (audio-clip)
+    
+    4array play-clips ;
+
 M: raytrace-world begin-game-world
     init-gpu
     { -2.0 6.25 10.0 } 0.19 0.55 set-wasd-view
     initial-spheres [ clone ] map >>spheres    
     raytrace-program <program-instance> <window-vertex-array> >>vertex-array
-    drop ;
+    set-up-audio ;
 
 CONSTANT: fov 0.7
 
 AFTER: raytrace-world resize-world
     dup dim>> dup first2 min >float v/n fov v*n >>fov drop ;
 
-AFTER: raytrace-world tick*
+AFTER: raytrace-world tick-game-world
     spheres>> [ tick-sphere ] each ;
 
 M: raytrace-world draw-world*
@@ -102,6 +122,9 @@ GAME: raytrace-game {
             double-buffered
         } }
         { grab-input? t }
+        { use-game-input? t }
+        { use-audio-engine? t }
+        { audio-engine-buffer-count 4 }
         { pref-dim { 1024 768 } }
         { tick-interval-micros $[ 60 fps ] }
     } ;
diff --git a/extra/gpu/demos/raytrace/red-ball.aiff b/extra/gpu/demos/raytrace/red-ball.aiff
new file mode 100644 (file)
index 0000000..cd08e88
Binary files /dev/null and b/extra/gpu/demos/raytrace/red-ball.aiff differ
diff --git a/extra/gpu/demos/raytrace/yellow-ball.aiff b/extra/gpu/demos/raytrace/yellow-ball.aiff
new file mode 100644 (file)
index 0000000..63b3790
Binary files /dev/null and b/extra/gpu/demos/raytrace/yellow-ball.aiff differ
index b5ed28cc3d8947152a2cf7bb0a779eaf5fe52f66..8251fe21b6dd9723b5d21584fad3a76e06783ba5 100644 (file)
@@ -4,7 +4,7 @@ game.input.scancodes game.loop game.worlds
 gpu.render gpu.state kernel literals
 locals math math.constants math.functions math.matrices
 math.order math.vectors opengl.gl sequences
-ui ui.gadgets.worlds specialized-arrays ;
+ui ui.gadgets.worlds specialized-arrays audio.engine ;
 FROM: alien.c-types => float ;
 SPECIALIZED-ARRAY: float
 IN: gpu.util.wasd
@@ -87,6 +87,9 @@ CONSTANT: fov 0.7
     [ yaw>> ] [ ?pitch ] [ wasd-movement-speed ] tri
     { 1.0 0.0 0.0 } n*v eye-rotate ;
 
+M: wasd-world audio-position location>> ; inline
+M: wasd-world audio-orientation forward-vector { 0.0 1.0 0.0 } <audio-orientation> ; inline
+
 : walk-forward ( world -- )
     dup forward-vector [ v+ ] curry change-location drop ;
 : walk-backward ( world -- )
@@ -121,7 +124,7 @@ CONSTANT: fov 0.7
 : wasd-mouse-input ( world -- )
     read-mouse rotate-with-mouse ;
 
-M: wasd-world tick*
+M: wasd-world tick-game-world
     dup focused?>> [
         [ wasd-keyboard-input ] [ wasd-mouse-input ] bi
         reset-mouse
index f28e685c6680199f16cbf61c06b98544a8879996..27bd7df403550bf3c98d0519d223bf4fbcc587ac 100644 (file)
@@ -217,7 +217,7 @@ terrain-world H{
     [ tick-player-reverse ]
     [ tick-player-forward ] if ;
 
-M: terrain-world tick*
+M: terrain-world tick-game-world
     [ dup focused?>> [ handle-input ] [ drop ] if ]
     [ dup player>> tick-player ] bi ;
 
@@ -295,6 +295,7 @@ GAME: terrain-game {
             double-buffered
             T{ depth-bits { value 24 } }
         } }
+        { use-game-input? t }
         { grab-input? t }
         { pref-dim { 1024 768 } }
         { tick-interval-micros $[ 60 fps ] }