extra: use ?download-to in a few more places.
parent
9ef4a4aab3
commit
d901af14c0
|
@ -23,7 +23,7 @@ TUPLE: bunny-world < demo-world model-triangles geom draw-seq draw-n ;
|
||||||
M: bunny-world begin-world
|
M: bunny-world begin-world
|
||||||
GL_DEPTH_TEST glEnable
|
GL_DEPTH_TEST glEnable
|
||||||
0.0 0.0 0.375 set-demo-orientation
|
0.0 0.0 0.375 set-demo-orientation
|
||||||
maybe-download read-model
|
download-bunny read-model
|
||||||
[ >>model-triangles ] [ <bunny-geom> >>geom ] bi
|
[ >>model-triangles ] [ <bunny-geom> >>geom ] bi
|
||||||
dup make-draws >>draw-seq
|
dup make-draws >>draw-seq
|
||||||
0 >>draw-n
|
0 >>draw-n
|
||||||
|
@ -49,12 +49,12 @@ bunny-world H{
|
||||||
} set-gestures
|
} set-gestures
|
||||||
|
|
||||||
MAIN-WINDOW: bunny-window {
|
MAIN-WINDOW: bunny-window {
|
||||||
{ world-class bunny-world }
|
{ world-class bunny-world }
|
||||||
{ title "Bunny" }
|
{ title "Bunny" }
|
||||||
{ pixel-format-attributes {
|
{ pixel-format-attributes {
|
||||||
windowed
|
windowed
|
||||||
double-buffered
|
double-buffered
|
||||||
T{ depth-bits { value 16 } }
|
T{ depth-bits { value 16 } }
|
||||||
} }
|
} }
|
||||||
{ pref-dim { 640 480 } }
|
{ pref-dim { 640 480 } }
|
||||||
} ;
|
} ;
|
||||||
|
|
|
@ -43,14 +43,10 @@ IN: bunny.model
|
||||||
|
|
||||||
: model-path ( -- path ) "bun_zipper.ply" cache-file ;
|
: model-path ( -- path ) "bun_zipper.ply" cache-file ;
|
||||||
|
|
||||||
: model-url ( -- url ) "http://duriansoftware.com/joe/media/bun_zipper.ply" ;
|
CONSTANT: model-url "http://duriansoftware.com/joe/media/bun_zipper.ply"
|
||||||
|
|
||||||
: maybe-download ( -- path )
|
: download-bunny ( -- path )
|
||||||
model-path dup exists? [
|
model-url model-path [ ?download-to ] keep ;
|
||||||
"Downloading bunny from " write
|
|
||||||
model-url dup print flush
|
|
||||||
over download-to
|
|
||||||
] unless ;
|
|
||||||
|
|
||||||
:: (draw-triangle) ( ns vs triple -- )
|
:: (draw-triangle) ( ns vs triple -- )
|
||||||
triple [| elt |
|
triple [| elt |
|
||||||
|
|
|
@ -148,10 +148,7 @@ UNIFORM-TUPLE: loading-uniforms
|
||||||
CONSTANT: bunny-model-url "http://duriansoftware.com/joe/media/bun_zipper.ply"
|
CONSTANT: bunny-model-url "http://duriansoftware.com/joe/media/bun_zipper.ply"
|
||||||
|
|
||||||
: download-bunny ( -- path )
|
: download-bunny ( -- path )
|
||||||
bunny-model-path dup exists? [
|
bunny-model-url bunny-model-path [ ?download-to ] keep ;
|
||||||
bunny-model-url dup print flush
|
|
||||||
over download-to
|
|
||||||
] unless ;
|
|
||||||
|
|
||||||
: get-bunny-data ( bunny-state -- )
|
: get-bunny-data ( bunny-state -- )
|
||||||
download-bunny bunny-data
|
download-bunny bunny-data
|
||||||
|
|
|
@ -42,10 +42,8 @@ IN: rosettacode.anagrams-deranged
|
||||||
deranged-anagrams [ first length ] sort-with last ;
|
deranged-anagrams [ first length ] sort-with last ;
|
||||||
|
|
||||||
: default-word-list ( -- path )
|
: default-word-list ( -- path )
|
||||||
"unixdict.txt" temp-file dup exists? [
|
URL" http://puzzlers.org/pub/wordlists/unixdict.txt"
|
||||||
URL" http://puzzlers.org/pub/wordlists/unixdict.txt"
|
"unixdict.txt" temp-file [ ?download-to ] keep ;
|
||||||
over download-to
|
|
||||||
] unless ;
|
|
||||||
|
|
||||||
: longest-deranged-anagrams ( -- anagrams )
|
: longest-deranged-anagrams ( -- anagrams )
|
||||||
default-word-list (longest-deranged-anagrams) ;
|
default-word-list (longest-deranged-anagrams) ;
|
||||||
|
|
|
@ -18,10 +18,9 @@ IN: rosetta-code.ordered-words
|
||||||
! this page.
|
! this page.
|
||||||
|
|
||||||
MEMO: word-list ( -- seq )
|
MEMO: word-list ( -- seq )
|
||||||
"unixdict.txt" temp-file dup exists? [
|
URL" http://puzzlers.org/pub/wordlists/unixdict.txt"
|
||||||
URL" http://puzzlers.org/pub/wordlists/unixdict.txt"
|
"unixdict.txt" temp-file
|
||||||
over download-to
|
[ ?download-to ] [ utf8 file-lines ] bi ;
|
||||||
] unless utf8 file-lines ;
|
|
||||||
|
|
||||||
: ordered-word? ( word -- ? )
|
: ordered-word? ( word -- ? )
|
||||||
>lower [ <= ] monotonic? ;
|
>lower [ <= ] monotonic? ;
|
||||||
|
|
Loading…
Reference in New Issue