Just because I was little curious, here's one I worked up for you:
Code: Select all
InitSprite()
InitKeyboard()
If ExamineScreenModes() = 0
MessageRequester("Error", "Screen is unavailable")
End
EndIf
sw = 5000 ;arbitrary high number
;looks for the smallest screen that meets our needs (could be improved to look for the best apsect ratio)
While NextScreenMode()
If ScreenModeDepth() = 32 And ScreenModeWidth() >=320 And ScreenModeWidth() <= sw
sw = ScreenModeWidth()
sh = ScreenModeHeight()
EndIf
Wend
If sw = 5000 Or sh = 0
MessageRequester("Error", "A suitable screen size is not available")
End
EndIf
sf = sw / 320 ;scale factor
OpenScreen(sw, sh, 32, "C64 load screen", #PB_Screen_WaitSynchronization)
SetFrameRate(30)
quit = 0
Repeat
;Comment out this StartDrawing()/StopDrawing area and uncomment the following one for a messier version
StartDrawing(ScreenOutput())
y = 0
h = 0
Repeat
h=Random(60, 5) * sf ;this gives a number between 5 and 60 that is then scaled
Box(0, y, OutputWidth(), h, RGB(Random(255),Random(255),Random(255)))
y + h
Until y >= OutputHeight()
StopDrawing()
;;This alternate method is a little messier and more realistic
; StartDrawing(ScreenOutput())
; y = 0
; h = 0
; c = RGB(Random(255),Random(255),Random(255))
; Repeat
; h = Random(25, 5) * sf ;this gives a number between 5 and 60 that is then scaled
; Box(0, y, OutputWidth(), h, c)
; y + h
; x = Random(40) * 8 * sf
; LineXY(0, y - 1, x - 1, y - 1, c)
; c = RGB(Random(255),Random(255),Random(255))
; LineXY(x, y - 1, OutputWidth(), y - 1, c)
; Until y >= OutputHeight()
; StopDrawing()
FlipBuffers()
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Escape)
quit = 1
EndIf
Until quit = 1
Oh yea, hit Escape to exit the demo.
Here's a version of the code using the color palette that oreopa provided with his code sample later in this thread.
Code: Select all
DataSection
ColorTable: ;pepto palette (attributed to oreopa)
Data.i $000000, $FFFFFF, $2B3768, $B2A470, $863D6F, $438D58, $792835, $6FC7B8
Data.i $254F6F, $003943, $59679A, $444444, $6C6C6C, $84D29A, $B55E6C, $959595
EndDataSection
Structure integer_array
i.i[0]
EndStructure
Global *a_PAL.integer_array = ?ColorTable
InitSprite()
InitKeyboard()
If ExamineScreenModes() = 0
MessageRequester("Error", "Screen is unavailable")
End
EndIf
sw = 5000 ;arbitrary high number
;looks for the smallest screen that meets our needs (could be improved to look for the best apsect ratio)
While NextScreenMode()
If ScreenModeDepth() = 32 And ScreenModeWidth() >=320 And ScreenModeWidth() <= sw
sw = ScreenModeWidth()
sh = ScreenModeHeight()
EndIf
Wend
If sw = 5000 Or sh = 0
MessageRequester("Error", "A suitable screen size is not available")
End
EndIf
sf = sw / 320 ;scale factor
OpenScreen(sw, sh, 32, "C64 load screen", #PB_Screen_WaitSynchronization)
SetFrameRate(30)
quit = 0
Repeat
;This alternate method is a little messier and more realistic
StartDrawing(ScreenOutput())
y = 0
h = 0
c = *a_PAL\i[Random(15)]
Repeat
h = Random(25, 5) * sf ;this gives a number between 5 and 60 that is then scaled
Box(0, y, OutputWidth(), h, c)
y + h
x = Random(40) * 8 * sf
LineXY(0, y - 1, x - 1, y - 1, c)
c = *a_PAL\i[Random(15)]
LineXY(x, y - 1, OutputWidth(), y - 1, c)
Until y >= OutputHeight()
StopDrawing()
FlipBuffers()
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Escape)
quit = 1
EndIf
Until quit = 1
@Edit: added second code sample using a select palette of colors instead of a completely random shade.