04-17-2025, 06:01 PM
Thanks.
I figured out the mouse problem... For a screensaver, we want it to quit if the user moves the mouse.
However I was having a problem where it would quit immediately even if the mouse wasn't touched.
What I found was, we need to save the initial mouse coordinates AFTER the SCREEN _NewImage.
But also, we need to give it a couple seconds to initialize, so we put in a _Delay 2 for good measure.
Here is one of @bplus's cooler eye candy proggies, with the mouse check added, it makes a great screensaver:
I figured out the mouse problem... For a screensaver, we want it to quit if the user moves the mouse.
However I was having a problem where it would quit immediately even if the mouse wasn't touched.
What I found was, we need to save the initial mouse coordinates AFTER the SCREEN _NewImage.
But also, we need to give it a couple seconds to initialize, so we put in a _Delay 2 for good measure.
Here is one of @bplus's cooler eye candy proggies, with the mouse check added, it makes a great screensaver:
Code: (Select All)
' Don't Attempt to Adjust Your Screen by bplus
' https://qb64phoenix.com/forum/showthread.php?tid=219&pid=1372#pid1372
_Title "Scrolling Plasma Lines Mod 1" 'B+ 2019-10-09
'Const fps = 60
Dim xmax, ymax As Integer
ReDim ln(0 To 0) As _Unsigned Long
Dim r, g, b As Long
Dim f As Long
Dim i As Long
Dim c As Long
Dim OldMouseX, OldMouseY As Integer
Randomize Timer
xmax = _DesktopWidth - 1
ymax = _DesktopHeight - 1
ReDim ln(0 To ymax) As _Unsigned Long
Screen _NewImage(xmax, ymax, 32)
_FullScreen
_Delay 2 ' wait a couple seconds before saving mouse location
While _MouseInput: Wend: OldMouseX = _MouseX: OldMouseY = _MouseY ' initial mouse placement
r = Rnd ^ 2: g = Rnd ^ 2: b = Rnd ^ 2
f = xmax / ymax
While _KeyDown(27) = 0
If Rnd < .05 Then r = Rnd ^ 2: g = Rnd ^ 2: b = Rnd ^ 2
For i = UBound(ln) - 1 To 0 Step -1
ln(i + 1) = ln(i)
Line (0, i)-Step(xmax, 0), ln(i + 1)
Line (xmax - i * f, 0)-Step(0, ymax), ln(i + 1)
Line (i * f, 0)-Step(f, ymax), ln(i + 1)
Line (0, ymax - i)-Step(xmax, 0), ln(i + 1)
Next
ln(0) = _RGB32(127 + 127 * Sin(r * c), 127 + 127 * Sin(g * c), 127 + 127 * Sin(b * c), 40)
c = c + 1: If c = 2147483647 Then c = 0 ' otherwise it will fail in 9,900 hours, and we can't have that, LOL
' If user moves mouse, quit
While _MouseInput: Wend: If _MouseX <> OldMouseX Or _MouseY <> OldMouseY Then Exit While
_Display
'_Limit fps
Wend
System