Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ######################################################
- ##
- ## Console:
- ##
- ## A grid-based virtual console, using the scroll
- ## registers to achieve pixel-wise animated scrolling
- ## rather than character-based scrolling. Note the
- ## use of revectoring to leverage the existing
- ## infrastructure of the Print lexicon.
- ##
- ## John Earnest
- ##
- ######################################################
- :include "../Print.fs"
- :include "../Vector.fs"
- :include "../Grid.fs"
- :include "../Util.fs"
- :image grid-tiles "transparentFont.png" 8 8
- :array console-display 1271 0
- :var cursor 0
- : console-emit ( char -- )
- dup 10 = if
- cursor @ 41 / 1 + 41 * cursor !
- else
- 32 - # our font's chars start at ASCII 32
- GP @ cursor @ + !
- cursor inc@
- then
- cursor @ 1230 > if
- # animate scrolling the grid
- 6 for 1 scroll-grid-y sync next
- # reset the scroll registers
- console-display GP !
- 0 SY !
- # shift the data on the grid
- 1228 for
- console-display 1228 + i - 41 + @
- console-display 1228 + i - !
- next
- # reposition the cursor
- cursor @ 41 - cursor !
- then
- ;
- : init-console ( -- )
- ' console-emit ' emit revector
- console-display GP !
- console-display grid-start !
- 41 grid-width !
- 31 grid-height !
- 0 cursor !
- 1270 for -1 console-display i + ! next
- ;
- : exit-console ( -- )
- ' emit devector
- ;
- :string hello "Hello, World!"
- : main
- init-console
- hello typeln
- hello typeln
- 0
- loop
- #hello type space
- dup .
- 1 +
- sync
- again
- ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement