Windowedscreen (ne répond pas)
Windowedscreen (ne répond pas)
Je ne comprend pas pourquoi mon petit programme plante au bout de quelques clics de souris en mode "WINDOWEDSCREEN" alors que tout se passe bien en plein écran.
Tu as raison...
Ci-joint mon code
InitSprite()
InitMouse()
InitKeyboard()
Taille_Chiffon_X=16
Taille_Chiffon_Y=16
Dim tableau (256,192)
Ma_fenetre = OpenWindow(0, 200, 200, 320, 320,#PB_Window_SystemMenu,"Cleaner")
;OpenScreen(1024,768,16,"rien")
OpenWindowedScreen(Ma_fenetre,0,0,256,192, 0, 0, 0)
LoadSprite(3072, "Data\Chiffon.bmp", 0)
StartDrawing(ScreenOutput())
DrawText("Salut")
FlipBuffers()
Delay (1000)
StopDrawing()
Repeat
;EventID.l = WaitWindowEvent()
StartDrawing(ScreenOutput())
For j=0 To 47
For k=0 To 63
If tableau(k,j)=0
Box(4*k,4*j,4,4,RGB(0,255,0))
EndIf
Next k
Next j
Box(x,y,16,16,RGB(0,0,0))
If MouseButton(1)
For b=1 To Taille_Chiffon_Y
For a=1 To Taille_Chiffon_X
tableau((x+a)/4,(y+b)/4)=1
Next a
Next b
EndIf
ExamineMouse()
ExamineKeyboard()
x = MouseX()
y = MouseY()
FlipBuffers()
IsScreenActive()
StopDrawing()
Until MouseButton(2)
End
InitSprite()
InitMouse()
InitKeyboard()
Taille_Chiffon_X=16
Taille_Chiffon_Y=16
Dim tableau (256,192)
Ma_fenetre = OpenWindow(0, 200, 200, 320, 320,#PB_Window_SystemMenu,"Cleaner")
;OpenScreen(1024,768,16,"rien")
OpenWindowedScreen(Ma_fenetre,0,0,256,192, 0, 0, 0)
LoadSprite(3072, "Data\Chiffon.bmp", 0)
StartDrawing(ScreenOutput())
DrawText("Salut")
FlipBuffers()
Delay (1000)
StopDrawing()
Repeat
;EventID.l = WaitWindowEvent()
StartDrawing(ScreenOutput())
For j=0 To 47
For k=0 To 63
If tableau(k,j)=0
Box(4*k,4*j,4,4,RGB(0,255,0))
EndIf
Next k
Next j
Box(x,y,16,16,RGB(0,0,0))
If MouseButton(1)
For b=1 To Taille_Chiffon_Y
For a=1 To Taille_Chiffon_X
tableau((x+a)/4,(y+b)/4)=1
Next a
Next b
EndIf
ExamineMouse()
ExamineKeyboard()
x = MouseX()
y = MouseY()
FlipBuffers()
IsScreenActive()
StopDrawing()
Until MouseButton(2)
End
Ajoute ca dans la boucle principale:
C'est pour gerer les messages que windows envoie à ta fenetre et pas qu'il pense que ta fenetre ne repond plus.
Code : Tout sélectionner
Repeat
wndEvent = WindowEvent()
If wndEvent
Select wndEvent
Case #PB_Event_CloseWindow
End
EndSelect
Else
Break
EndIf
ForEver