FlipBuffer qui fait clignoter [Résolu]
Publié : ven. 12/nov./2010 19:27
Salut,
je desespere de PB.
Le flipbuffer permet d'echanger les ecrans sans que les sprites clignotent. Mais je voulais faire des scenes animé a la another world avec des polygons et la, ca clignote !!!!
Il me semble qu'il existait avant des options dans flipbuffer mais plus maintenant.
Dois je saborder mon ordi (et par la meme occasion PB) ???
Creez quelques polygons de quelques cotés et vous verrez comment ca clignote en haut !!!!
EDIT : corrigé
Souris pour creer des polygons
ENTRER pour enregistrer le polygon courant
je desespere de PB.
Le flipbuffer permet d'echanger les ecrans sans que les sprites clignotent. Mais je voulais faire des scenes animé a la another world avec des polygons et la, ca clignote !!!!
Il me semble qu'il existait avant des options dans flipbuffer mais plus maintenant.
Dois je saborder mon ordi (et par la meme occasion PB) ???

Creez quelques polygons de quelques cotés et vous verrez comment ca clignote en haut !!!!
EDIT : corrigé
Souris pour creer des polygons
ENTRER pour enregistrer le polygon courant
Code : Tout sélectionner
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Another earth
; SPH(2010)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
InitSprite()
InitKeyboard()
InitMouse()
#dw=1024
#dh=768
#dc=32
If OpenScreen(#dw,#dh,#dc,"Another Earth")=0
MessageRequester("Erreur", "Screen Open ("+Str(#dw)+","+Str(#dh)+",32) : impossible à ouvrir", 0) : End
EndIf
nb=256
key=1
mode=2
Dim bank.w(9000000)
nb_total_polygon=0
ici_bank=0
bank(ici_bank)=nb_total_polygon : ici_bank+1
Dim ps.Point(nb-1) ; Array of 5 POINT structures
Dim ps2.Point(nb-1) ; Array of 5 POINT structures
; For p=0 To nb-1
; ps(p)\x=Random(1024)
; ps(p)\y=Random(768)
; Next p
cmb=0
CreateSprite(0,#dw,#dh)
color=RGB(255,255,255)
Repeat
DisplaySprite(0,0,0)
;;;;; tracage
ExamineMouse()
mx=MouseX()
my=MouseY()
Mb_Right=MouseButton(#PB_MouseButton_Right)
Mb_Left=MouseButton(#PB_MouseButton_Left)
If Mb_left
ps(cmb)\x=mx
ps(cmb)\y=my
cmb+1
If cmb>245
Beep_(800,50)
EndIf
Repeat
ExamineMouse()
Mb_Left=MouseButton(#PB_MouseButton_Left)
Until Mb_Left=0
EndIf
If Mb_Right
cmb-1
If cmb<0
cmb=0
EndIf
Repeat
ExamineMouse()
Mb_Right=MouseButton(#PB_MouseButton_Right)
Until Mb_Right=0
EndIf
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Space)
mode+1
mode%3
ExamineKeyboard()
While KeyboardPushed(#PB_Key_Space)
ExamineKeyboard()
Wend
EndIf
If mode=2
; For i=0 To ici_bank+4
; Debug bank(i)
; Next
; End
la=1
For i=1 To bank(0)
u=bank(la)
; Dim ps2.Point(nb-1) ; Array of 5 POINT structures
la+1
If bank(la)<>-1
Debug "bank<>-1":End
EndIf
la+1
rvb=RGB(bank(la),bank(la+1),bank(la+2))
la+3
For p=0 To u
ps2(p)\x=bank(la):la+1
ps2(p)\y=bank(la):la+1
Next p
hDC=StartDrawing(ScreenOutput())
Box(0,0,0,0,rvb) ; Would be nice to have a Cls() facility !!!
SetWindowOrgEx_(hDC,00,00,#Null) ; Move origin downwards
Polygon_(hDC,@ps2(0),u+1)
StopDrawing()
Next
EndIf
If KeyboardPushed(#PB_Key_Return) Or KeyboardPushed(#PB_Key_PadEnter)
bank(ici_bank) =cmb-1 : ici_bank+1
bank(ici_bank) =-1 : ici_bank+1
bank(ici_bank) =Red(color) : ici_bank+1
bank(ici_bank) =Green(color) : ici_bank+1
bank(ici_bank) =Blue(color) : ici_bank+1
For i=0 To cmb-1
bank(ici_bank) = ps(i)\x : ici_bank+1
bank(ici_bank) = ps(i)\y : ici_bank+1
Next
bank(0)+1
;DisplaySprite(0,0,0)
hDC=StartDrawing(ScreenOutput())
Box(0,0,0,0,color) ; Would be nice to have a Cls() facility !!!
SetWindowOrgEx_(hDC,00,00,#Null) ; Move origin downwards
Polygon_(hDC,@ps(0),cmb)
StopDrawing()
;GrabSprite(0,0,0,#dw,#dh)
cmb=0
;Delay(500)
ExamineKeyboard()
While KeyboardPushed(#PB_Key_Return) Or KeyboardPushed(#PB_Key_PadEnter)
ExamineKeyboard()
Wend
key+1
EndIf
;ClearScreen(0)
;temps = ElapsedMilliseconds()
; Define drawing area
hDC=StartDrawing(ScreenOutput())
Box(0,0,0,0,color) ; Would be nice to have a Cls() facility !!!
If mode>0
SetWindowOrgEx_(hDC,00,00,#Null) ; Move origin downwards
Polygon_(hDC,@ps(0),cmb)
EndIf
LineXY(mx,0,mx,#dh,RGB(255,0,0))
LineXY(0,my,#dw,my,RGB(255,0,0))
Plot(mx,my,RGB(0,255,0))
StopDrawing()
;temps = ElapsedMilliseconds()-temps
;Debug temps
;End
LoadFont(1, "Arial", 8)
StartDrawing(ScreenOutput())
DrawingMode(#PB_2DDrawing_Default)
DrawingFont(FontID(1))
DrawText(0,0," Polyg. : "+Str(key)+" - Point : "+Str(cmb)+" ", RGB(255,255,255))
DrawText(0,15," Mode : "+Str(mode)+" ", RGB(255,255,255))
StopDrawing()
FlipBuffers()
;Delay(4)
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
End
;;;;;;;;;;;;;;;