Fix ogg.player and space-invaders

db4
Slava Pestov 2008-02-22 00:47:43 -06:00
parent fd9d3d39bb
commit e455dd0362
2 changed files with 6 additions and 5 deletions

2
extra/ogg/player/player.factor Normal file → Executable file
View File

@ -149,7 +149,7 @@ HINTS: yuv>rgb byte-array byte-array ;
dup player-gadget [
dup { player-td player-yuv } get-slots theora_decode_YUVout drop
dup player-rgb over player-yuv yuv>rgb
dup player-gadget find-world dup draw-world
dup player-gadget find-world draw-world
] when ;
: num-audio-buffers-processed ( player -- player n )

View File

@ -3,8 +3,9 @@
!
USING: cpu.8080 cpu.8080.emulator openal math alien.c-types
sequences kernel shuffle arrays io.files combinators ui.gestures
ui.gadgets ui.render opengl.gl system threads match
ui byte-arrays combinators.lib ;
ui.gadgets ui.render opengl.gl system match
ui byte-arrays combinators.lib qualified ;
QUALIFIED: threads
IN: space-invaders
TUPLE: space-invaders port1 port2i port2o port3o port4lo port4hi port5o bitmap sounds looping? ;
@ -337,7 +338,7 @@ M: space-invaders update-video ( value addr cpu -- )
: sync-frame ( millis -- millis )
#! Sleep until the time for the next frame arrives.
1000 60 / >fixnum + millis - dup 0 >
[ sleep ] [ drop yield ] if millis ;
[ threads:sleep ] [ drop threads:yield ] if millis ;
: invaders-process ( millis gadget -- )
#! Run a space invaders gadget inside a
@ -356,7 +357,7 @@ M: invaders-gadget graft* ( gadget -- )
dup invaders-gadget-cpu init-sounds
f over set-invaders-gadget-quit?
[ millis swap invaders-process ] curry
"Space invaders" spawn drop ;
"Space invaders" threads:spawn drop ;
M: invaders-gadget ungraft* ( gadget -- )
t swap set-invaders-gadget-quit? ;