Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "crt.bi"
- const SCREEN_WIDTH = 20, SCREEN_HEIGHT = 13
- width SCREEN_WIDTH+2,SCREEN_HEIGHT
- dim shared as integer TextRow,iC=10
- sub Clean()
- color ,0: cls
- for L as integer = 1 to SCREEN_HEIGHT
- locate L, SCREEN_WIDTH+1
- color 7: print "|";
- next L
- locate 1,1: TextRow = 0
- end sub
- sub TypeText2 (pzText as zstring ptr)
- var pzBegin = cast(ubyte ptr,pzText)
- var pzCurrent = pzBegin, pzEnd = pzBegin
- var X = 0, iAdvanceLine = 0
- do
- select case *pzCurrent
- case asc(!"\n"),0 : pzEnd = pzCurrent: iAdvanceLine = 1
- case asc(" ") : pzEnd = pzCurrent
- case asc(!"\r") : pzCurrent += 1: continue do
- end select
- if iAdvanceLine or X >= SCREEN_WIDTH then
- if pzEnd = pzBegin then
- pzEnd = pzCurrent: pzCurrent += (*pzCurrent<>asc(!"\n"))
- else
- pzCurrent = pzEnd
- end if
- iC xor= 1: color iC,1
- while pzBegin < pzEnd
- if *pzBegin <> asc(!"\r") then
- print chr$(*pzBegin);
- 'pCon.Lock()
- 'CharPtr(X, TextRow) = Text[CharNum]
- 'pCon.Unlock()
- end if
- pzBegin += 1: sleep 25,1
- wend
- if *pzEnd = 0 then exit do
- TextRow += 1: X = 0 : iAdvanceLine = 0
- pzCurrent += 1: pzBegin = pzCurrent: pzEnd = pzCurrent
- locate TextRow+1,1
- else
- X += 1: pzCurrent += 1
- end if
- loop
- end sub
- Clean()
- TypeText2( _
- !"Hello World :] we have a big sentence that was indeed split by spaces.\r\n" _
- !"it may end splitting several lines!\r\n" _
- !"NoSpacesButSplitting\n\nExactlyAtWrap.\r\n" _
- !"ThisHasNoSpacesSoWhatDoiDoNow?\r\n" _
- !"Last Line." )
- sleep
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement