Re: un tetris
Publié : ven. 05/oct./2012 8:32
Je dirais que oui, si tu as mis le flag "#PB_Screen_SmartSynchronization" dans l'OpenScreen=> c'est son rôle, normalement.
le PB_Screen_SmartSynchronization est dans le openwindows ! C'est grave ?kelebrindae a écrit :Je dirais que oui, si tu as mis le flag "#PB_Screen_SmartSynchronization" dans l'OpenScreen=> c'est son rôle, normalement.
Code : Tout sélectionner
If InitSprite() And InitMouse() And InitKeyboard() ;And InitSound()
Else
End
EndIf
If OpenWindow(0, 400, 40, 400, 600, "Tetris", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Screen_SmartSynchronization)
;- Main loop
Repeat
Delay(1)
Repeat
; Traite TOUS les événements Windows, afin d'éviter qu'ils s'accumulent dans la file d'attente.
Event = WindowEvent()
Select Event
Case #PB_Event_CloseWindow
Quit = #True
EndSelect
Until Event = 0
;- Keyboard
If ExamineKeyboard()
; ...Gestion du clavier...
EndIf
;- Mouse
If ExamineMouse()
; ...Gestion de la souris si tu l'utilises (pas forcément nécessaire, dans un Tetris)...
EndIf
;- Logique du jeu
;- Gestion des graphismes (DisplaySprites ou autre)
;- Flipbuffers pour affichage et fin de la boucle
FlipBuffers()
Until Quit = #True
EndIf
End ; All the opened windows are closed automatically by PureBasic
Code : Tout sélectionner
If InitSprite() And InitMouse() And InitKeyboard() ; And InitSound()
Else
End
EndIf
If OpenWindow(0, 400, 40, 400, 600, "Tetris", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
OpenWindowedScreen(WindowID(0), 0, 0, 100, 100, 1, 0, 0, #PB_Screen_WaitSynchronization)
;- Main loop
Repeat
Repeat
; Traite TOUS les événements Windows, afin d'éviter qu'ils s'accumulent dans la file d'attente.
Event = WindowEvent()
Select Event
Case #PB_Event_CloseWindow
Quit = #True
EndSelect
Until Event = 0
;- Keyboard
If ExamineKeyboard()
; ...Gestion du clavier...
EndIf
;- Mouse
If ExamineMouse()
; ...Gestion de la souris si tu l'utilises (pas forcément nécessaire, dans un Tetris)...
EndIf
;- Logique du jeu
;- Gestion des graphismes (DisplaySprites ou autre)
;- Flipbuffers pour affichage et fin de la boucle
FlipBuffers()
Until Quit = #True
EndIf
End ; All the opened windows are closed automatically by PureBasic