bon voici ton code en 15 fps chez moi , ça utilise le Screen !
teste le pour voir
par contre le degradé s'affiche bien temps reel , chez moi
pour info c'est ecrit dans la doc , le CircularGradient ne fonctionne QUE sur Canvas ou Image
Note: Cette commande a un effet uniquement sur des surfaces de type ImageOutput() et CanvasOutput().
donc pour utiliser sur un screen , faut d'abord dessiner dans une image, pis t'affiche l'image dans le screen !
comme ça :
note , pas besoin de timer, ni de Thread
Code : Tout sélectionner
IncludeFile "bass.pbi"
IncludeFile "bass2.pbi"
UsePNGImageDecoder()
InitSprite()
Enumeration
#Sherman
#Fond
#Window
#image
EndEnumeration
Define File.s
Global streamID, width,height, ShermanX,ShermanY, FPScount,FPS
#width = 800
#height = 600
Declare TH_Background(param)
If CountProgramParameters() = 0
File = OpenFileRequester("Choisissez un fichier à lire","","Musique|*.wav;*.mp3;*.ogg|Wave|*.wav|MP3|*.mp3",0)
Else
File = ProgramParameter(0)
EndIf
LoadImage(#Sherman,"M4_Sherman_early_normandy.png")
ShermanX = (#width/2)-(ImageWidth(#Sherman)/2)
ShermanY = (#height/2)-(ImageHeight(#Sherman)/2)
OpenWindow(#Window, 0, 0, #width,#height,"Sherman - ",#PB_Window_ScreenCentered | #PB_Window_SystemMenu)
CreateImage(#image,#width,#height,32,$0)
OpenwindowedScreen(windowID(#Window),0,0,#width,#height)
retval_init = BASS_Init(-1,48000,0,WindowID(#Window),0)
streamID = BASS_StreamCreateFile(#False,File,0,0,#BASS_UNICODE | #BASS_SAMPLE_FLOAT | #BASS_SAMPLE_LOOP)
BASS_ChannelPlay(streamID,0)
Global TempsDepart
;- Boucle principale
Repeat
If (Now-Ticks) > 999
Ticks = Now
FramePerSec.s = "FPS: " + Str( FrameCounter )
FrameCounter = 0
EndIf
event = WaitWindowEvent(2)
StartDrawing(imageOutput(#image))
TH_Background(param)
DrawingMode(#PB_2DDrawing_Transparent )
Box(0,0,10,10,clr)
DrawText(11,0,FramePerSec.s,rgb(255,255,255))
StopDrawing()
StartDrawing(ScreenOutput())
DrawImage(imageId(#image),0,0)
FrameCounter + 1
StopDrawing()
FlipBuffers()
Now = GetTickCount_()
;ClearScreen($0)
Until event = #PB_Event_CloseWindow
;-Procedures
Procedure TH_Background(param)
Protected vol,volf.f,clr.i
vol = BASS_ChannelGetLevel(streamID)
vol = (vol & $FFFF)
volf = (vol/32768)*255
If clr = $FFFFFF
clr = 0
Else
clr = $FFFFFF
EndIf
Box(0,0,#width,#height,$000000)
FrontColor($000000)
BackColor(RGB(volf,volf,volf))
DrawingMode(#PB_2DDrawing_Gradient)
CircularGradient(#width/2,#height/2,500)
Box(0,0,#width,#height,RGB(volf,volf,volf))
DrawingMode(#PB_2DDrawing_AlphaBlend)
DrawAlphaImage(ImageID(#Sherman),ShermanX, ShermanY,255)
EndProcedure
; Epb