Another strange effect :
Global s$
; Constantes
#WINTITLE = "E-Swat - Replicants Remake"
#WINHEIGHT = 480 ; Impossible de faire du 320x200, résolution minimale 640x480
#WINWIDTH = 640
#BPP = 32
#SPRH = 16
#SPRW = 16
;Declaration procedure
Declare PrintTransparentSprite(IdSprite, x, y , r, g, b)
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
;
; 8x8
; DC.B ' ---------------- '
; DC.B ' -THE REPLICANTS- '
; DC.B ' ---------------- ',$00
; DC.B ' PRESENTS: - ESWAT + - '
; DC.B ' '
; DC.B 'GREETZ TO : AVB,NEXT,AUTOMATION,TMB '
; DC.B 'THE POMPEY PIRATES,PHALANX,ALLIANCE,BB, '
; DC.B 'DELIGHT,FOF,TLB,TDI,QUARTET,HTL,MCA, '
; DC.B 'THOR,MAD VISION,INNER CIRCLE,TSG... ',$00
; DC.B ' '
; DC.B 'MEGA THANX TO THE BWK FOR DIS LOGO... ',$00
; DC.B ' BASH ',$27,'T',$27,' FOR TRAINER ',$FF
;
s$ = " ---------------- " + Chr(10) + Chr(13)
s$ = s$ + " -THE REPLICANTS- " + Chr(10) + Chr(13)
s$ = s$ + " ---------------- " + Chr(10) + Chr(13) + Chr(10) + Chr(13)
s$ = s$ + " PRESENTS: - ESWAT + - " + Chr(10) + Chr(13) + Chr(10) + Chr(13)
s$ = s$ + "GREETZ TO : AVB,NEXT,AUTOMATION,TMB " + Chr(10) + Chr(13)
s$ = s$ + "THE POMPEY PIRATES,PHALANX,ALLIANCE,BB, " + Chr(10) + Chr(13)
s$ = s$ + "DELIGHT,FOF,TLB,TDI,QUARTET,HTL,MCA, " + Chr(10) + Chr(13)
s$ = s$ + "THOR,MAD VISION,INNER CIRCLE,TSG... " + Chr(10) + Chr(13) + Chr(10) + Chr(13)
s$ = s$ + "MEGA THANX TO THE BWK FOR DIS LOGO... " + Chr(10) + Chr(13) + Chr(10) + Chr(13)
s$ = s$ + " BASH 'T' FOR TRAINER " + Chr(10) + Chr(13)
; print a sprites
Procedure PrintTransparentSprite(IdSprite, x, y, r, g, b)
TransparentSpriteColor(IdSprite, RGB(r,g,b))
DisplayTransparentSprite(IdSprite, x, y)
EndProcedure
; 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)
PrintTransparentSprite(IdSprite, x, y, r, g, b)
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
Result = CatchSprite(0, ?fontsReps, #PB_Sprite_Texture)
Result = CatchSprite(1, ?logoReps, #PB_Sprite_Texture)
Result = CreateImage(12, #WINWIDTH, #WINHEIGHT,#BPP)
ClearScreen(0)
Repeat
xpad = 0
ypad = 0
StartDrawing(ImageOutput(12))
For i = 1 To Len(s$) Step 1
car$ = Mid(s$, i , 1)
Select car$
Case Chr(10)
ypad = ypad + #SPRH
Case Chr(13)
xpad = 0
Default
getFonts(0,xpad, ypad+156, #SPRW, #SPRH, getLetterPos(car$), 0, 0, 0)
xpad = xpad + #SPRW
EndSelect
Next i
PrintTransparentSprite(1, 0, 0, 0, 0, 0)
StopDrawing()
; ClearScreen(0)
StartDrawing(ScreenOutput())
DrawImage(ImageID(12),0,100,640,480) ; On my pb linux version this code print at x = 0, y = 0, image height = 100 but !!! On the doc, it's drawimage(Id, x, y, w, h) so x = 0, y = 100 and image height= 480 and width = 640....
StopDrawing() ; It's really obvious !!!! :'(
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
; IDE Options = PureBasic 4.51 (Linux - x86)
; CursorPosition = 196
; FirstLine = 158
; Folding = -
; EnableXP
The interesting code snippet :
...
; ClearScreen(0)
StartDrawing(ScreenOutput())
DrawImage(ImageID(12),0,100,640,480) ; On my pb linux version this code print at x = 0, y = 0, image height = 100 but !!! On the doc, it's drawimage(Id, x, y, w, h) so x = 0, y = 100 and image height= 480 and width = 640....
StopDrawing() ; It's really obvious !!!! :'(
FlipBuffers()
If fullscreen = 0
Event = WaitWindowEvent(0)
EndIf
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape) Or KeyboardPushed(#PB_Key_Space) Or KeyboardPushed(#PB_Key_T)
...
Do you have the same bug with pb for windows ?
With a screenshot to proof it.