64 lines
1.8 KiB
Plaintext
64 lines
1.8 KiB
Plaintext
EnableExplicit
|
|
|
|
Macro Check(Function)
|
|
If Not Function : End : EndIf
|
|
EndMacro
|
|
|
|
Check(InitKeyboard()) ; Cannot initialize keyboard
|
|
Check(InitSprite()) ; Cannot initialize sprite/screen library
|
|
Check(ExamineDesktops()) ; Cannot retrieve informations about desktops
|
|
|
|
Define.i iHeight, iWidth, iDepth
|
|
iHeight = DesktopHeight(0)
|
|
iWidth = DesktopWidth(0)
|
|
iDepth = DesktopDepth(0)
|
|
|
|
If OpenScreen(iWidth, iHeight, iDepth, "Press ENTER to exit")
|
|
Define.i bMode.b, iLines, fLine.f, iRow, iSpans, fSpan.f,
|
|
fColor.f, iTop, iWide, iHigh, iCol, iShade
|
|
If StartDrawing(ScreenOutput())
|
|
|
|
bMode = #True ; Pow = #True; Add = #False
|
|
iLines = 4 ; Number of Lines
|
|
|
|
If iLines < 1 : iLines = 1 : EndIf ; Pow/Add-Min
|
|
If bMode
|
|
If iLines > 6 : iLines = 6 : EndIf ; Pow-Max
|
|
Else
|
|
If iLines > 32 : iLines = 32 : EndIf ; Add-Max
|
|
EndIf
|
|
fLine = iHeight / iLines
|
|
iLines - 1
|
|
|
|
For iRow = 0 To iLines
|
|
If bMode
|
|
iSpans = Pow(2, iRow + 3) - 1 ; Pow: 8, 16, 32, 64, 128, 256
|
|
Else
|
|
iSpans = (iRow + 1) * 8 - 1 ; Add: 8, 16, 24, 32, 40, 48, ...
|
|
EndIf
|
|
fSpan = iWidth / (iSpans + 1)
|
|
fColor = 255 / iSpans
|
|
iTop = Round(iRow * fLine, #PB_Round_Up)
|
|
iWide = Round(fSpan, #PB_Round_Up)
|
|
iHigh = Round(fLine, #PB_Round_Up)
|
|
For iCol = 0 To iSpans
|
|
iShade = Round(fColor * iCol, #PB_Round_Nearest)
|
|
If iRow % 2 <> 0 : iShade = 255 - iShade : EndIf ; Alternation
|
|
Box(Round(iCol * fSpan, #PB_Round_Up), iTop, iWide, iHigh,
|
|
RGB(iShade, iShade, iShade))
|
|
Next
|
|
Next
|
|
|
|
StopDrawing()
|
|
FlipBuffers()
|
|
|
|
Repeat
|
|
Delay(30)
|
|
ExamineKeyboard()
|
|
Until KeyboardPushed(#PB_Key_Escape) Or
|
|
KeyboardPushed(#PB_Key_Return)
|
|
EndIf
|
|
CloseScreen()
|
|
EndIf
|
|
End
|