Sign in to follow this  
Followers 0

Stupid screensaver help

2 posts in this topic

Just for fun I'm trying to make a simple screensaver that looks like it's snowing (*). I've been able to get to point where the flakes fall at a slight different pace, but as you can see with the example code below, it ain't perfect. I can't get it to work in an array loop. I only posted enough that covers part of the left side of the screen, but it's only 1 row of flakes. I can work on getting more to fall later, but now I just want to know how to get this work in a loop rather than write the lables over and over.

If there are any suggestions on how to do this better, I'm open to ideas...


Share this post

Link to post
Share on other sites

a little better

HotKeySet("{ESC}", "Terminate")

Dim $Title = "Snow"

GUICreate($Title, @DesktopWidth, @DesktopHeight, 0, 0, 0x80000000)
GUISetFont(12, 400, "", "Terminal")

Dim $w = 5
Dim $h = 0
Dim $Snow[18]
Dim $Flakes = 17
Dim $i
Dim $Pos
Dim $Speed = 20
Dim $n
Dim $r2

For $x = 1 To $Flakes
    $Snow[$x] = GUICtrlCreateLabel("*", 5, 4, 12, 15)
    GUICtrlSetColor(-1, 0xFFFFFF)

While 1
    $place = 5
    $r2 = 2
    $i = 0
    For $i = 0 To 17
        $n = Random(0, $r2, 1)
        $Pos = ControlGetPos($Title, "", $Snow[$i])
        ControlMove($Title, "", $Snow[$i], $place, $Pos[1] + $n)
        $place = $place + 15
    If $h = @DesktopHeight Then $h = 0

Func Terminate()
EndFunc  ;==>Terminate



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0