USING: arrays calendar combinators.smart io kernel literals namespaces random random.data raylib sequences threads timers unicode ; IN: hello-raylib SYMBOL: color SYMBOL: text CONSTANT: COLORS $[ RED GREEN BLUE 3array ] : current-color ( -- color ) color get-global ; : current-text ( -- text ) text get-global ; : clear ( -- ) RAYWHITE clear-background ; : hello-world ( -- ) current-text 10 10 32 current-color draw-text ; : idle-frame ( -- ) 16 milliseconds sleep ; : with-draw ( quote -- ) clear begin-drawing call end-drawing idle-frame ; inline : randomize-color ( -- ) COLORS random color set-global ; : ranodmize-letter ( Letter -- Letter ) [ Letter? ] [ drop random-Letter ] smart-when ; : randomize-text ( -- ) text [ [ ranodmize-letter ] map ] change-global ; : main ( -- ) 600 450 "Hello, World!" init-window randomize-color "Hello, World!" text set-global [ randomize-color ] 250 milliseconds every drop [ randomize-text ] 125 milliseconds every drop [ window-should-close ] [ [ hello-world ] with-draw ] until close-window ; MAIN: main