[REBOL] Re: The OldsKool Demo :-)
From: antonr:iinet:au at: 19-Sep-2003 15:03
Very nice!
Now for some optimizations :)
; scroll1
;c1: load %c1.bmp c2: load %c2.bmp c3: ...
;cars1: [ " " c1 "A" c2 "B" c3 "C" c4 "D" c5 ...
Instead of using the system above, try this:
cars1: " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,:!?+-*/()"
bmps: copy []
repeat n length? cars1 [append bmps load join %c [n ".bmp"]]
And later on:
; scroll1
;for n1 1 nb-car-ecran1 1 [ ; Use repeat instead of for.
repeat n1 nb-car-ecran1 [ ; Less code and a little faster.
pos1: n1
either pos1 < (nb-car-ecran1 - pos-scroll1) [
;car1: select cars1 to-string " "
car1: if find cars1 " " [select bmps index? find cars1 " "]
] [ pos1: pos-scroll1 + n1 - nb-car-ecran1
;car1: select cars1 to-string scroll1/:pos1
car1: if find cars1 scroll1/:pos1 [pick bmps index? find cars1
scroll1/:pos1]
]
You could also save all your bitmaps in one file, then
you can load them all at once into bmps.
save %bmps1.r bmps
bmps: reduce load %bmps1.r
Anton.