banner
 .::Others::. Windows Space Screensaver Go to original post Author: KVD - Translator:  - Entry Date: 13/02/2009 09:39:22
Windows Space Screensaver

Code:


#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

[digg] [delicious] [google] [yahoo] [technorati] [reddit] [stumbleupon]
Other posts in the same group:

Windows Space Screensaver
Go to top Go to original post  

Powered by JForum - Extended by HVAOnline
 hvaonline.net  |  hvaforum.net  |  hvazone.net  |  hvanews.net  |  vnhacker.org
1999 - 2013 © v2012|0504|218|