My Dear Maracuja

,
I don't understand why you say Purebasic is different of SDL?!? You are using exactly the "same" things with it!
SDL_BlitSurface(fonts, &src, screen, &dst); -> DisplaySprite(0, sco+cco, 320)
SDL_FillRect(finalScreen, NULL, 0); -> Clearscreen(0)
SDL_BlitSurface(prefinalScreen, NULL, finalScreen, &dst); // Here I print the logos/fonts at dst.y position until 0.
SDL_BlitSurface(finalScreen, NULL, screen, NULL); // Here i copy the finalbuffer on the screen
SDL_Flip(screen); // flipbuffers() like
-> Flipbuffers() yep, the switch between logical and physical screen are completely transparent!
So you just have to work onto the logical screen (ScreenOutput()) and display it after all jobs....
But to be back at your question, I think you want to know how to make a scoll text in a buffer to display it everywhere onto screen.
I've sent you the STCS remake code! It is using a "pre-buffered" sprite like you want! I create a sprite first, then I display all the font needed inside, and then i display the sprite everywhere on the screen - I must admit - using DisplayTransparentSprite or Peek & Poke (Hi PadMan!)
The trick is:
you can't sprite into a sprite! So you have 3 options:
1- using images, and DrawImage() and displaying them into the sprite.
2- using your self-sprite rout with Peek & Poke and working in byte mode in the sprite (see STCS remake)!
3- display onto the screen at start of frame, grabbing the part of the screen in a sprite, clearing the screen, displaying all the other effect, and then displaying the sprite you created at first onto the rest!!! and at the end flipbuffers()!
Here is the version using the third technique (based on the last version of Padman):
Global s$,s1$
; Constantes
Global sco=0
Global tptr=1
#WINTITLE = "E-Swat - Replicants Remake"
#WINHEIGHT = 480 ; Impossible de faire du 320x200, résolution minimale 640x480
#WINWIDTH = 640
#BPP = 32
s1$=" I'M SUPPOSED TO BE A SCROLLTEXT SCROLLING HAPPILY OVER THE SCREEN "
;Declaration procedure
Declare getLetterPos(caractere$)
Declare getFonts(IdSprite, x, y, w, h, num, r, g, b)
Declare ErrorWindowCreation()
Declare Anim(fullscreen.b)
Declare PrintTextWindows(text$)
;Include text
XIncludeFile "Payload.pbi" ; crack message
; give the position of caractere$ in alpha variable.
; parameters:
; In :
; - caractere$ : a char to find in a array which synchronized with letter on a bitmap fonts
; Out :
; - an integer which returns the good position if the char exist else 0 but here 0 is space.
Procedure getLetterPos(caractere$)
alpha$ = " !" + Chr(34) + " '()*+,-. 0123456789:; = ? ABCDEFG"
alpha$ = alpha$ + "HIJKLMNOPQRSTUVWXYZ"
length = Len(alpha$);
i = 1;
While (Mid(alpha$, i, 1) <> Mid(caractere$, 1, 1) And i <= length)
i = i + 1
Wend
If i > length
ProcedureReturn 0
EndIf
ProcedureReturn i;
EndProcedure
; take the good bitmap char in a sprite picture. Before num computed by getLetterPos
; parameters :
; In :
; - IdSprite : sprite handle which contains bitmap fonts
; - x,y : letter position in pixel in a pic
; - w,h : width, height in pixel for a letter
; - num : logic letter position in a pic
; - r,g,b : transparency color for sprite
; Out:
;
Procedure getFonts(IdSprite, x, y, w, h, num, r, g, b)
fontsW = SpriteWidth(IdSprite) ; [!] Just take with sprite width
; ClipSprite(IdSprite, #PB_Default, #PB_Default, #PB_Default, #PB_Default)
; reinit original sprite size after clipping
posX = (num-1) % ((fontsW / w))
posY = (num-1) / ((fontsW / w))
srcX = (posX) * w
srcY = (posY) * h
srcH = h
srcW = w
ClipSprite(IdSprite, srcX, srcY, srcW, srcH)
TransparentSpriteColor(IdSprite, RGB(r,g,b))
DisplayTransparentSprite(IdSprite, x, y)
ClipSprite(IdSprite, #PB_Default, #PB_Default, #PB_Default, #PB_Default)
EndProcedure
; Generic Error function.
Procedure ErrorWindowCreation()
MessageRequester("Error", "This is fucked up, I can't create the window", 0)
End
EndProcedure
; Animatation routine
; In:
; - fullscreen.b : create an animation in fullscreen mode or not. Two state: 0/false -> windowed mode, 1/true -> fullscreen
: Out:
;
Procedure Anim(fullscreen.b)
;Init subsystem and the windows with fullscreen or not
InitSprite()
InitKeyboard()
If fullscreen
If OpenScreen(#WINWIDTH, #WINHEIGHT, #BPP, #WINTITLE) = 0
ErrorWindowCreation()
EndIf
Else
If OpenWindow(1337,0,0,#WINWIDTH, #WINHEIGHT, #WINTITLE, #PB_Window_BorderLess | #PB_Window_ScreenCentered)
If Not OpenWindowedScreen(WindowID(1337), 0, 0, #WINWIDTH, #WINHEIGHT, 1, 0, 0)
ErrorWindowCreation()
EndIf
Else
ErrorWindowCreation()
EndIf
EndIf
;Animation
CatchSprite(0, ?fontsReps, #PB_Sprite_Texture)
;####################################################################
Repeat
; we are working in the LOGICAL screen, not displayed!!!
; we display the scrolltext at line 0
cco = 0
For cc = 0 To 25 ; change to higher value to start further right
letter = Asc(Mid(s1$, tptr+cc, 1))-31 ;your font is in ascii order, no need for special lookup index
yCharPos = letter / 40
xCharPos = letter % 40
If xcharpos= 0: xcharpos = 40 : ycharpos=yCharPos-1 :EndIf
If xCharPos <- 1: xCharPos = 39
ElseIf xCharPos > 0 : xCharPos = xCharPos - 1
EndIf
ClipSprite(0, xCharPos*8, yCharPos*8, 8, 8)
DisplaySprite(0, sco+cco, 0)
cco = cco + 8
Next
sco = sco -2 ;change scrollspeed here
;
If sco < -8
tptr = tptr + 1
sco = sco + 8
EndIf
;
If tptr > Len(s1$)-31
tptr = 1
EndIf
; we grab the sprite from the screen (so the screen was used as buffer!!!)
GrabSprite(12,0,0,320,8)
; now we make like a normal frame, everything drawed after this will be dispayed!
ClearScreen(0)
xpad = 0
ypad = 0
For i = 1 To Len(s$) Step 1
car$ = Mid(s$, i , 1)
Select car$
Case Chr(10)
ypad = ypad + 8
Case Chr(13)
xpad = 0
Default
getFonts(0,xpad, ypad+156, 8, 8, getLetterPos(car$), 0, 0, 0)
xpad = xpad + 8
EndSelect
Next i
; at least I display the sprite created from the "buffer" (screen) onto the rest!
TransparentSpriteColor(12,RGB(0,0,0))
DisplayTransparentSprite(12,0,200+50*Sin(Radian(ang)))
ang = ang + 2
If ang > 360
ang = 0
EndIf
;##########################################################################
FlipBuffers()
If fullscreen = 0
Event = WaitWindowEvent(0)
EndIf
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape) Or KeyboardPushed(#PB_Key_Space) Or KeyboardPushed(#PB_Key_T)
EndProcedure
; Init the question for fullscreen or windowed mode. After selection the button, the animation will be in a good screen mode
; In :
; - text$ : Is the message for MessageBox
; Out :
;
Procedure PrintTextWindows(text$)
Result = MessageRequester(#WINTITLE, text$,#PB_MessageRequester_YesNoCancel)
Select Result
Case #PB_MessageRequester_Yes
Anim(#True)
Case #PB_MessageRequester_No
Anim(#False)
EndSelect
EndProcedure
;!!!!! Begin !!!!!
PrintTextWindows("Credits : Jace, Padman, StormBringer !!! and you ;o)"+ Chr(10) + Chr(13) + "Do you want Fullscreen ? :)")
End ; va!n advice
;!!!!! End !!!!!
DataSection
fontsReps: IncludeBinary("eswatFonts.bmp")
logoReps: IncludeBinary("eswatLogo.bmp")
EndDataSection
As you can see, you are using a buffer

Next post, the first way!