Code: Select all
#Window = 0
Width.w = GetSystemMetrics_(SM_CXFullScreen)
Height.w = GetSystemMetrics_(SM_CYFullScreen)
Title.s = "Drawing Test"
Global c1.w, c2.w, c3.w
Global x1.w, x2.w
Global w1.w, w2.w
Declare RedrawScene()
Declare Destroy()
Declare Randomize()
WindowID = OpenWindow( #Window, 0, 0, Width, Height, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered, Title )
If WindowID = 0
MessageBox_(0, "Could not create window!", "Error", MB_OK)
End
EndIf
RedrawScene()
Randomize()
Repeat
Randomize()
EventID.l = WaitWindowEvent()
Select EventID
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Repaint
RedrawScene()
EndSelect
Until Quit = 1
Destroy()
End
Procedure RedrawScene()
StartDrawing(WindowOutput())
FrontColor(c1,c2,c3)
Box(x1,x2,w1,h1)
StopDrawing()
EndProcedure
Procedure Randomize()
c1 = Random(255)
c2 = Random(255)
c3 = Random(255)
x1 = Random(Width)
y1 = Random(Height)
w1 = Random(Width)
h1 = Random(Height)
EndProcedure
Procedure Destroy()
CloseWindow(#Window)
EndProcedure

