Skip to content

Instantly share code, notes, and snippets.

@greggirwin
Last active October 19, 2017 18:31
Show Gist options
  • Save greggirwin/0bdbac82f1731cd2b2ef4e3862128536 to your computer and use it in GitHub Desktop.
Save greggirwin/0bdbac82f1731cd2b2ef4e3862128536 to your computer and use it in GitHub Desktop.
Pekr's News Scroller, converted to DRAW
Red [
Title: "Simple news scroller"
Author: "@pekr, updated by Gregg Irwin"
]
;system/view/auto-sync?: no
screen-size: system/view/screens/1/size
news-bottom-offset: 0x100
news-height: 0x100
message: "Simple news scroller. Who makes me faster and smoother? ..."
;--- style for draw dialect
bold64: make font! [style: 'bold size: 64 color: white]
;--- just to calculate text size ....
txt: make face! compose [size: 3000X200 text: (message)]
txt/font: make font! [style: 'bold size: 64 color: white]
text-size: size-text txt
offset: as-pair screen-size/x 0
draw-blk: compose [font bold64 text (offset) (message)]
win: view/options/flags/no-wait compose/deep [
origin 0x0
news: base green text-size draw draw-blk
][
size: as-pair screen-size/x text-size/y
offset: as-pair 0 (screen-size/y - news-bottom-offset/y - news-height/y)
][no-border]
forever [
offset: offset - 1x0
if (offset/x + (text-size/x)) < 0 [offset/x: screen-size/x]
draw-blk/4: offset
; show news
do-events/no-wait
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment