RosettaCodeData/Task/Window-creation/PureBasic/window-creation.basic

27 lines
737 B
Text
Raw Permalink Normal View History

2024-04-19 16:56:29 -07:00
Define.i MyWin, Event, x, y
x = 400
y = 300
2023-07-01 11:58:00 -04:00
2024-04-19 16:56:29 -07:00
If OpenWindow(0, 0, 0, x, y, "I am a window - PureBasic", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If CreateImage(0, x, y) And StartDrawing(ImageOutput(0))
DrawingMode(#PB_2DDrawing_Transparent)
Box(0, 0, x, y, #White)
For i = 1 To 10
DrawText(x/3, y/2, "Hello World!", #Black)
;DrawText(Random(200), Random(200), "Hello World!", RGB(Random(255), Random(255), Random(255)))
Next i
StopDrawing()
ImageGadget(0, 0, 0, x, y, ImageID(0))
EndIf
2023-07-01 11:58:00 -04:00
2024-04-19 16:56:29 -07:00
Repeat
Event = WaitWindowEvent()
Select Event
2023-07-01 11:58:00 -04:00
Case #PB_Event_Gadget
2024-04-19 16:56:29 -07:00
; Handle any gadget events here
2023-07-01 11:58:00 -04:00
Case #PB_Event_CloseWindow
2024-04-19 16:56:29 -07:00
Break
EndSelect
ForEver
EndIf