bitte schaut euch das mal an, ob euch dazu was einfällt.
Ich hatte diesen komischen Effekt und habe mal nach der Ursache gesucht.
Wird ein File Selector aufgemacht, etwas stehen gelassen und dann abgebrochen, fällt der voreingestellte 40ms Schritt Timer aus.
Dies passiert auch beim verschieben des Fensters oder bei einer Alert Box.
Steht zum Beispiel eine Alert Box 5 Minuten und wird dann beendet, geht zuerst mal gar nix mehr.
Die Linien rasen und das Fenster freezt.
Es passiert nur wenn ein zweiter Timer aktiviert ist.
Fixen kann man es zB. indem man einen Button in der main loop zyklisch aufruft.
Code: Alles auswählen
Procedure Linie(x.i, y.i, xx.i, yy.i, shift.a, color.l, lr.i)
; Achtung Plot unterstützt kein Clipping
Protected a.i, dx.i, dy.i, addval.i = 1
Protected *plotX.Integer = @xx, *plotY.Integer = @yy
If Abs(x - xx) <= Abs(y - yy) ; Winkel größer 45°
Swap x, y
Swap xx, yy
*plotX = @yy
*plotY = @xx
EndIf
If x < xx
Swap x, xx
Swap y, yy
EndIf
If y < yy
y = 2 * yy - y
addval = -1
EndIf
dy = 2 * (y - yy)
a = x - xx
dx = 2 * a
While xx <= x
If shift & 1
Plot(*plotX\i, *plotY\i, color)
EndIf
If lr
shift = (shift << 1) | ((shift >> 7) & $7f)
Else
shift = ((shift >> 1) & $7F) | (shift << 7)
EndIf
xx + 1
a - dy
If a <= 0
a + dx
yy + addval
EndIf
Wend
EndProcedure
;-------------------------------------------
Procedure Liniego(x.i, y.i, xx.i, yy.i, color.l, move.i, shift.a, lr.i)
For i=0 To move
shift = (shift << 1) | ((shift >> 7) & $7f)
Next i
Linie(x, y, xx, yy, shift, color, lr)
EndProcedure
;-------------------------------------------
Procedure Boxgo(x.i, y.i, xx.i, yy.i, color.l, move.i, shift.a, lr.i)
xx - 1 : yy - 1
If lr
Liniego(x, y, x + xx, y, color, move, shift, 1)
Liniego(x + xx, y, x + xx, y + yy, color, move, shift, 1)
Liniego(x, y + yy, x + xx, y + yy, color, move, shift, 0)
Liniego(x, y + yy, x, y, color, move, shift, 0)
Else
Liniego(x, y, x + xx, y, color, move, shift, 0)
Liniego(x + xx, y, x + xx, y + yy, color, move, shift, 0)
Liniego(x, y + yy, x + xx, y + yy, color, move, shift, 1)
Liniego(x, y + yy, x, y, color, move, shift, 1)
EndIf
EndProcedure
; --------Loop-----------------------------
ExamineDesktops()
If OpenWindow (0, DesktopWidth(0) / 2 - 200, DesktopHeight(0) / 2 - 250, 500, 300, "")
CanvasGadget(0, 0, 0, 500 , 200)
AddWindowTimer(0, 1, 40)
AddWindowTimer(0, 2, 100) ; Ist Dieser Timer deaktiviert, ist es weg ##########################
ButtonGadget(1,150,230,200,40,"Hit me")
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow:
End
Case #PB_Event_Timer
If EventTimer()=1
If StartDrawing(CanvasOutput(0))
Box (0, 0, 500, 200, $FFFFFF)
DrawingMode(#PB_2DDrawing_Outlined) ; Zeichnen von Flächen erfolgt nicht ausgefüllt
Boxgo (148, 68, 204, 104, $0 , move, %11110000,1)
Boxgo (149, 69, 202, 102, $0 , move, %11110000,1)
Boxgo (150, 70, 200, 100, $0 , move, %11110000,1)
StopDrawing()
EndIf
move +1 ; Animations Counter für bewegte Linien
If move >7 : move = 0 : EndIf
; ButtonGadget(2,-100,0,0,0,"") ; Ist dieser Button aktiviert, ist es weg ##########################
EndIf
Case #PB_Event_Gadget
If EventGadget()
MessageRequester("Test","Warte mal wenigstens eine Minute und schau dann mal nach den bewegten Linien")
EndIf
EndSelect
ForEver
EndIf