Make focusable-child* work even if world has no children, to clean up a code duplication
parent
379ba2d777
commit
1f9fa090a3
|
@ -101,7 +101,7 @@ M: world layout*
|
||||||
[ call-next-method ]
|
[ call-next-method ]
|
||||||
[ dup layers>> [ as-big-as-possible ] with each ] bi ;
|
[ dup layers>> [ as-big-as-possible ] with each ] bi ;
|
||||||
|
|
||||||
M: world focusable-child* gadget-child ;
|
M: world focusable-child* children>> [ t ] [ first ] if-empty ;
|
||||||
|
|
||||||
M: world children-on nip children>> ;
|
M: world children-on nip children>> ;
|
||||||
|
|
||||||
|
|
|
@ -21,5 +21,3 @@ M: game-world end-world
|
||||||
[ [ stop-loop ] when* f ] change-game-loop
|
[ [ stop-loop ] when* f ] change-game-loop
|
||||||
drop ;
|
drop ;
|
||||||
|
|
||||||
M: game-world focusable-child* drop t ;
|
|
||||||
|
|
||||||
|
|
|
@ -36,9 +36,6 @@ M: demo-world distance-step ( gadget -- dz )
|
||||||
: zoom-demo-world ( distance gadget -- )
|
: zoom-demo-world ( distance gadget -- )
|
||||||
[ + ] with change-distance relayout-1 ;
|
[ + ] with change-distance relayout-1 ;
|
||||||
|
|
||||||
M: demo-world focusable-child* ( world -- gadget )
|
|
||||||
drop t ;
|
|
||||||
|
|
||||||
M: demo-world pref-dim* ( gadget -- dim )
|
M: demo-world pref-dim* ( gadget -- dim )
|
||||||
drop { 640 480 } ;
|
drop { 640 480 } ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue