Nice work shockwave... i have updated the source to work with PB v4.02... btw, dont use StringName$.s because String.s and String$ are not the same thing (its silly i know ^^) So here we go with the updated versio
; Sine Scroll Coded By Nick Simpson 2005.
; Updated a bit, commented and added error handling to work with PB v4.02
; by va!n (thorsten will) in 2007
;
;============================================================================================
Global xres.w , yres.w , loop.w ,xp.w , yp.w , t.s , tptr.w , sco.b
xres = 800 ; ScreenWidth
yres = 600 ; ScreenHeight
sco = 0
tptr = 1
t.s = " "
t.s = t.s+"HELLO.. THIS IS MY FIRST ATTEMPT AT A DEMO WRITTEN IN PUREBASIC, THE LANGUAGE SEEMS TO BE A LITTLE BIT TRICKY "
t.s = t.s+"BUT IN FAIRNESS IT'S LEARNABLE AT LEAST AND IT SEEMS TO BE QUITE FAST SO I'LL PUT UP WITH IT... "
t.s = t.s+"NOW TO ADD SOME STARS, A LOGO AND SOME MUSIC AND THEN IT WILL BE FINISHED... HAPPY 2006.. NICK."
t.s = t.s+" "
; -------- Init needed Stuff --------
InitSprite() ; Needed to init DX Screen and DX Drawings
InitKeyboard() ; Needed for handling DX keyboard inputs
UsePNGImageDecoder() ; Needed to work with PNG Image
Dim gfxfont(60) ; DIM for handling the handle of each char image
; -------- Load Font Gfx --------
font = LoadImage (#PB_Any, "font.PNG") ; Load the font PNG image
If font = 0 ; If loading image failed,
MessageRequester("Error", "Cant load font.PNG", 0) ; we alert an error and
End ; stop the application
EndIf
; -------- If Font successfully load, open Screen --------
window = OpenScreen( xres , yres , 32 , "PBWINDOW") ; Open DirectX Screen
If window = 0 ; If creating DX screen failed,
MessageRequester("Error", "Cant open Window", 0) ; we alert an error and
End ; stop the application
EndIf
; -------- Creating for each bitmap char an own Image --------
StartDrawing (ScreenOutput()) ; Drawing loaded FONT Image
DrawImage (ImageID(font),0,0) ; to the DX screen...
StopDrawing()
xp = 0
yp = 0
For loop =1 To 60 ; Grabing from the screen
gfxfont(loop) = GrabImage(font,#PB_Any,xp,yp,31,31) ; each char as single image
xp = xp + 32 ; and save its handle to the
; ; DIM gfxfont()
If xp > = 320
yp = yp + 33
xp = 0
EndIf
Next
; -------- MainLoop --------
Repeat
ClearScreen($0) ; Clear Screen with color $0
ExamineKeyboard() ; Update for keyboard inputs
StartDrawing (ScreenOutput()) ; Start drawing on DX Screen
cco = 0
For cc = 0 To 25
letter = (Asc(Mid(t.s, tptr+cc, 1))-31)
DrawImage (ImageID(gfxfont(letter)), (sco+cco), 300+50*Sin((cc+cco+sco+m)/120))
cco = cco + 32
Next
m = m -5
sco = sco -3
If sco < -32
tptr = tptr + 1
sco=sco + 32
EndIf
If tptr > (Len(t.s)-30 )
tptr = 1
EndIf
StopDrawing() ; Stop drawing on DX Screen
FlipBuffers() ; Bring backround buffer to forground
Until KeyboardPushed (#PB_Key_Escape) ; Repeats until key ESCAPE has pressed
End