11-01-2025, 01:41 AM
(This post was last modified: 11-01-2025, 01:42 AM by Unseen Machine.)
(10-31-2025, 10:15 AM)aadityap0901 Wrote: I made a screensaver, inspired from the windows pipes screensaver and linux pipes.sh:Nostalgic to say the least! I'd like to see more than one pipe be generated at once though and as it's YOU, the exploding sphere from Windows 95! Thats DEFO in your wheelhouse!
Code: (Select All)Screen _NewImage(_DesktopWidth, _DesktopHeight, 32)
_MouseHide
Randomize Timer
_FullScreen _SquarePixels
_Font 8
DefLng A-Z
TW = _Width / _FontWidth
TH = _Height / _FontHeight
X = Rnd * TW
Y = Rnd * TH
D = 0
nD = 0
oD = 0
Dim As _Unsigned _Byte R, G, B
R = 128 + Rnd * 127
G = 128 + Rnd * 127
B = 128 + Rnd * 127
Color _RGB32(R, G, B), &HFF000000
Do
_Limit 60
If Rnd < 0.1 And Rnd < 0.5 Then nD = Int(Rnd * 3) + 1 Else nD = 2
nD = ClampCycle(0, D - nD + 2, 3)
Select Case D
Case 0: X = X + 1
Case 1: Y = Y + 1
Case 2: X = X - 1
Case 3: Y = Y - 1
End Select
If X < 0 Or X >= TW Or H < 0 Or H >= TH Then
R = 128 + Rnd * 127
G = 128 + Rnd * 127
B = 128 + Rnd * 127
Color _RGB32(R, G, B), &HFF000000
End If
X = ClampCycle(0, X, TW - 1)
Y = ClampCycle(0, Y, TH - 1)
Select Case _SHL(nD, 2) Or oD
Case 0, 10: C = 196
Case 5, 15: C = 179
Case 1, 14: C = 192
Case 4, 11: C = 191
Case 3, 6: C = 218
Case 9, 12: C = 217
Case Else: Print _SHL(D, 2) Or oD: End
End Select
_PrintString (X * _FontWidth, Y * _FontHeight), Chr$(C)
D = nD
oD = D
_Display
Loop Until (_MouseInput And (_MouseButton(1) Or _MouseButton(2) Or _MouseButton(3))) Or InKey$ <> ""
System
Function Clamp (A, B, C)
Clamp = B - (A - B) * (B < A) - (C - B) * (C < B)
End Function
Function ClampCycle (A, B, C)
ClampCycle = B - (C - B) * (B < A) - (A - B) * (C < B)
End Function
John

