old code drawing issue
Posted: Wed Aug 30, 2023 7:01 pm
I'm looking at some old code viewtopic.php?p=444710#p444710 written by oreopa in 2014
which executes but only runs in the bottom left corner of the screen.

Why is that? I'm guessing something has changed in the Purebasic syntax since the code was first written many years ago?
Or is it a Mac issue as I'm running on a Mac ?
Code: Select all
Global Dim a_PAL(15) ; pepto palette
a_PAL(0) = $000000
a_PAL(1) = $FFFFFF
a_PAL(2) = $2B3768
a_PAL(3) = $B2A470
a_PAL(4) = $863D6F
a_PAL(5) = $438D58
a_PAL(6) = $792835
a_PAL(7) = $6FC7B8
a_PAL(8) = $254F6F
a_PAL(9) = $003943
a_PAL(10) = $59679A
a_PAL(11) = $444444
a_PAL(12) = $6C6C6C
a_PAL(13) = $84D29A
a_PAL(14) = $B55E6C
a_PAL(15) = $959595
If InitSprite()
If OpenWindow(0, 0, 0, 820, 620, "Old School Decrunch Effect...", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
If OpenWindowedScreen(WindowID(0), 10, 10, 800, 600, #True, 10, 10, #PB_Screen_NoSynchronization) ; x, y position, width, height, autostretch
If CreateSprite(1,ScreenWidth(),256*2)
If StartDrawing(SpriteOutput(1))
For y = 0 To OutputHeight()-2 Step 2
Box(0,y,OutputWidth(),2,a_pal(Random(15)))
Next y
StopDrawing()
EndIf
Repeat
Repeat
MyEvent = WindowEvent()
If MyEvent = #PB_Event_CloseWindow
Quit = #True
Break
EndIf
Until MyEvent = 0
FlipBuffers()
If IsScreenActive()
ClearScreen(0)
For a = 0 To ScreenHeight()-1 Step 4
x=0
While x<ScreenWidth()
length = Random(ScreenWidth()/8)
ClipSprite(1,0,Random(256)*2,length,2)
DisplaySprite(1,x,a)
x+length
Wend
Next a
StopDrawing()
Delay(Random(100))
EndIf
Until Quit = #True
EndIf
EndIf
EndIf
EndIf
which executes but only runs in the bottom left corner of the screen.

Why is that? I'm guessing something has changed in the Purebasic syntax since the code was first written many years ago?
Or is it a Mac issue as I'm running on a Mac ?