Code: Alles auswählen
InitSprite()
InitKeyboard()
Enumeration
#Window
EndEnumeration
Structure Ball
x.i
y.i
dx.i
dy.i
Rot.i
Gruen.i
Blau.i
EndStructure
NewList Baelle.Ball()
Macro NeueRichtung
Repeat
\dx = Random(4) - 2
\dy = Random(4) - 2
Until \dx <> 0 Or \dy <> 0
EndMacro
ExamineDesktops()
OpenWindow(#Window, #PB_Ignore, #PB_Ignore, DesktopWidth(0) - 200, DesktopHeight(0) - 200, "ClearScreen() Test", #PB_Window_MinimizeGadget|#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(#Window), 0, 0, WindowWidth(#Window), WindowHeight(#Window), 0, 0, 0)
Repeat
ClearList(Baelle())
WeiteX = WindowWidth(#window)
WeiteY = WindowHeight(#window)
For n = 1 To 5
AddElement(Baelle())
With Baelle()
\x = Random(WeiteX - 10) + 5
\y = Random(WeiteY - 10) + 5
NeueRichtung
\Rot=Random(255)
\Gruen=Random(255)
\Blau=Random(255)
EndWith
Next
Repeat
ClearScreen(0)
Delay(2)
If WindowEvent() = #PB_Event_CloseWindow : End : EndIf
ForEach Baelle()
With Baelle()
\x + \dx
\y + \dy
If \x < 5 Or \x > WeiteX - 5 Or \y < 5 Or \y > WeiteY - 5
NeueRichtung
EndIf
EndWith
Next
StartDrawing(ScreenOutput())
ForEach Baelle()
With Baelle()
Circle(\x, \y, 10, RGB(\Rot,\Gruen,\Blau))
EndWith
Next
StopDrawing()
FlipBuffers()
ExamineKeyboard()
Until KeyboardReleased(#PB_Key_Escape)
ForEver
Scheint sich bis heute nichts geändert zu haben. Mit Fehlersuche und Forumsuche habe ich mehrere Stunden vergeudet.
Ich hoffe, jemand zeigt mir, dass der Fehler bei mir liegt.
Windows XP SP 3 PB 4.51