Je me suis fait un petit sinus/jump scrolltext avec la version 4.30 Demo, et mon code n'est pas fluide !!
Qui pourrait m'expliquer pourquoi ces 2 version de mon code ne vont pas à la même vitesse :
Code "Rapide" :
If initsprite () =0 Or initkeyboard ()=0 Or initmouse ()=0
messagerequester ( "Error" , "Sprite system can't be initialized" , 0)
End
EndIf
msg.s= "Pourquoi mon Sinus/Jump Scroll râme autant ??? "
loadfont (1, "comic sans MS" , 30)
If openwindow (0,0,0,800,600, "Mon 1er Starfield" , #PB_Window_SystemMenu | #PB_Window_ScreenCentered )
If openwindowedscreen ( windowid (0),0,0,800,600,1,0,0)
clearscreen ( rgb (255,255,255))
x=800
sens=-1
Repeat
startdrawing ( windowoutput (0))
drawingfont ( fontid (1))
If x<=- textwidth (msg)+5
x=800
EndIf
drawtext (x,( sin ((x+120)/800* #PI *3)*64)+350,msg)
Event= waitwindowevent ()
examinekeyboard ()
examinemouse ()
x=x+sens
stopdrawing ()
delay (2)
Until keyboardpushed ( #PB_Key_Escape ) Or Event= #PB_Event_CloseWindow
EndIf
EndIf
End
Code "Lent" :
If initsprite () =0 Or initkeyboard ()=0 Or initmouse ()=0
messagerequester ( "Error" , "Sprite system can't be initialized" , 0)
End
EndIf
msg.s= "Pourquoi mon Sinus/Jump Scroll râme autant ??? "
loadfont (1, "comic sans MS" , 30)
If openwindow (0,0,0,800,600, "Mon 1er Starfield" , #PB_Window_SystemMenu | #PB_Window_ScreenCentered )
If openwindowedscreen ( windowid (0),0,0,800,600,1,0,0)
clearscreen ( rgb (255,255,255))
x=800
sens=-1
Repeat
startdrawing ( windowoutput (0))
drawingfont ( fontid (1))
If x<=- textwidth (msg)+5
x=800
EndIf
drawtext (x,( sin ((x+120)/800* #PI *3)*64)+350,msg)
Event= waitwindowevent ()
examinekeyboard ()
examinemouse ()
x=x+sens
stopdrawing ()
clearscreen ( rgb (255,255,255))
flipbuffers ()
delay (2)
Until keyboardpushed ( #PB_Key_Escape ) Or Event= #PB_Event_CloseWindow
EndIf
EndIf
End