RosettaCodeData/Task/Colour-bars-Display/BASIC/colour-bars-display-6.basic

32 lines
942 B
Plaintext

Dim color(7)
color(0) = RGB($00, $00, $00) ;black
color(1) = RGB($FF, $00, $00) ;red
color(2) = RGB($00, $FF, $00) ;green
color(3) = RGB($00, $00, $FF) ;blue
color(4) = RGB($FF, $00, $FF) ;magenta
color(5) = RGB($00, $FF, $FF) ;cyan
color(6) = RGB($FF, $FF, $00) ;yellow
color(7) = RGB($FF, $FF, $FF) ;white
If Not InitKeyboard(): End: EndIf ;can't init keyboard
If Not InitSprite(): End: EndIf ;can't init sprite/screen library
If Not ExamineDesktops(): End: EndIf ;can't retrieve information about desktop
height = DesktopHeight(0)
width = DesktopWidth(0)
depth = DesktopDepth(0)
If OpenScreen(width, height, depth, "Press ENTER to exit")
StartDrawing(ScreenOutput())
For c = 0 To 7
Box((width * c) / 8, 0, width / 8, height, color(c))
Next
StopDrawing()
FlipBuffers()
Repeat
Delay(10)
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape) Or KeyboardPushed(#PB_Key_Return)
CloseScreen()
EndIf