Remarque : C'est le gif qui sacade, pas à la compilation
Voici module pour faire un fond en Parallax
Le zip depuis github
Maintenant je ne suis pas certain que ma technique soit bonne, cela prend pas de mal de ressource entre 20% et 28% du processeur c'est quant même bkp.<EDIT> Bon même si j'affiche pas les sprites c'est idem
exemple du code :
Code : Tout sélectionner
EnableExplicit
UsePNGImageDecoder()
#MainForm = 0
If Not InitSprite()
MessageRequester("SYSTEM ERROR","cannot init sprite engine",#PB_MessageRequester_Error)
End
EndIf
If Not InitKeyboard()
MessageRequester("SYSTEM ERROR","cannot init keyboard engine",#PB_MessageRequester_Error)
End
EndIf
If Not OpenWindow(#MainForm,0,0,800,600,"test",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
MessageRequester("SYSTEM ERROR","cannot open window",#PB_MessageRequester_Error)
End
EndIf
If Not OpenWindowedScreen(WindowID(#MainForm),0,0,WindowWidth(#MainForm),WindowHeight(#MainForm),#True,0,#PB_Screen_WaitSynchronization )
MessageRequester("SYSTEM ERROR","cannot open the game screen",#PB_MessageRequester_Error)
End
EndIf
IncludePath "Packages/"
XIncludeFile "PARALLAX.pbi"
UseModule PARALLAX
Global myParallax. Parallax = newParallax(0,0,800,600)
myParallax\addBackGround(newBackground("Assets/Parallax/plx-1.png",0))
myParallax\addBackGround(newBackground("Assets/Parallax/plx-2.png",0.1))
myParallax\addBackGround(newBackground("Assets/Parallax/plx-3.png",0.3))
myParallax\addBackGround(newBackground("Assets/Parallax/plx-4.png",0.4))
myParallax\addBackGround(newBackground("Assets/Parallax/plx-5.png",0.8))
Global gEvent,exit.b = #False
Repeat ; screen event
Repeat ; window event
gEvent = WindowEvent()
If gEvent = #PB_Event_CloseWindow : exit = #True : EndIf
Until gEvent = 0
ClearScreen(RGB(255,255,255))
myParallax\display(1)
FlipBuffers()
Until exit