Jump to content

Windows Space Screensaver


CoePSX
 Share

Recommended Posts

I was just playing around and decided to mimic the windows space screensaver.

The idea is very simple, but it looks just like the windows one.

#include <GUIConstants.au3>

Global Const $NumberOfStars = 50
Global Const $Speed = 75  ;From 0 To 100
Global Const $Width = 640
Global Const $Height = 480

Global Const $Pi = 3.1415926535897932384626433832795
$Window = GUICreate("SPACE", $Width, $Height, -1, -1)
GUISetBkColor(0)

;Pick random positions for the stars
Dim $StarsArray[$NumberOfStars+1][4]
For $i = 0 To $NumberOfStars
    $Alpha = Random(0, 360, 1)
    $Radius = Random(0, 250, 1)
    $StarsArray[$i][0] = GUICtrlCreateLabel("", 0, 0, 1, 1)
    $StarsArray[$i][1] = $Alpha
    $StarsArray[$i][2] = $Radius
    $StarsArray[$i][3] = 1
    GUICtrlSetBkColor($StarsArray[$i][0], 0xFFFFFF)
Next

GUISetState()

While 1
    For $i = 0 To $NumberOfStars
        ;Recycle stars that are out of the screen
        If $StarsArray[$i][2] > $Width/2 Then
            $Alpha = Random(0, 360, 1)
            $Radius = Random(0, 250, 1)
            $StarsArray[$i][1] = $Alpha
            $StarsArray[$i][2] = $Radius
            $StarsArray[$i][3] = 1
        EndIf
        
        ;Adjust the thickness of the star
        Select
            Case $StarsArray[$i][2] > $Width/8 And $StarsArray[$i][2] < $Width/3
                $StarsArray[$i][3] = 2
            Case $StarsArray[$i][2] > $Width/3
                $StarsArray[$i][3] = 3
        EndSelect
        
        ;Moves the current star
        $StarsArray[$i][2] += 10
        $X = Sin(($StarsArray[$i][1]*($Pi/180))) * $StarsArray[$i][2] + $Width/2
        $Y = Cos(($StarsArray[$i][1]*($Pi/180))) * $StarsArray[$i][2] + $Height/2
        GUICtrlSetPos($StarsArray[$i][0], $X, $Y, $StarsArray[$i][3], $StarsArray[$i][3])
    Next
    Sleep(100-$Speed)
WEnd

[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Link to comment
Share on other sites

Wow thats very nice :P

--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...