CODICE
;//=========// MatteoJug //========//;
; Orologio Analogico 0.1
; Skin: Knok
GUICreate("Orologio Analogico", 400, 500)
GUISetBkColor(0xFFFFFF)
if not FileExists(@ScriptDir & "/sfondo.jpg") then InetGet("http://img403.imageshack.us/img403/7733/sfondobs6.jpg",@ScriptDir & "/sfondo.jpg")
GUICtrlCreatePic(@ScriptDir & "/sfondo.jpg", 0, 0, 400, 500)
GUICtrlSetState(-1, 128)
Global $Raggio = 170, $PI = 3.1415926535897932384626433832795, $Sec = @SEC, $Raggio_Element_Sec[$Raggio], $Min = @MIN, $Raggio_Element_Min[$Raggio], $Hour = @HOUR, $Raggio_Element_Hour[$Raggio]
Global $Color_Sec = 0xffffff, $Color_Min = 0xff8a21, $Color_Hour = 0xffff00
$Label_Hour = GUICtrlCreateLabel(@HOUR, 10, 410, 90, 90)
GUICtrlSetColor(-1, $Color_Hour)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetFont(-1, 50)
$Label_Min = GUICtrlCreateLabel(@MIN, 150, 410, 90, 90)
GUICtrlSetColor(-1, $Color_Min)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetFont(-1, 50)
$Label_Sec = GUICtrlCreateLabel(@SEC, 300, 410, 90, 90)
GUICtrlSetColor(-1, $Color_Sec)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetFont(-1, 50)
GUICtrlCreateLabel(":", 110, 405, 20, 90)
GUICtrlSetColor(-1, 0xff8a21)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetFont(-1, 50)
GUICtrlCreateLabel(":", 260, 405, 20, 90)
GUICtrlSetColor(-1, 0xff8a21)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetFont(-1, 50)
_Start()
GUISetState()
While 1
If GUIGetMsg() = -3 Then Exit
If $Sec <> @SEC Then
$Sec = @SEC
For $i = 0 To $Raggio - 1
$curX = 400 / 2 + Cos($PI / 2 - ($Raggio * $Sec / 60 * $PI / ($Raggio / 2))) * $i
$curY = 400 / 2 - Sin($PI / 2 - ($Raggio * $Sec / 60 * $PI / ($Raggio / 2))) * $i
GUICtrlSetPos($Raggio_Element_Sec[$i], $curX, $curY)
Next
GUICtrlSetData($Label_Sec, $Sec)
EndIf
If $Min <> @MIN Then
$Min = @MIN
For $i = 0 To $Raggio - 1
$curX = 400 / 2 + Cos($PI / 2 - ($Raggio * ($Min+$Sec/60) / 60 * $PI / ($Raggio / 2))) * $i
$curY = 400 / 2 - Sin($PI / 2 - ($Raggio * ($Min+$Sec/60) / 60 * $PI / ($Raggio / 2))) * $i
GUICtrlSetPos($Raggio_Element_Min[$i], $curX, $curY)
Next
GUICtrlSetData($Label_Min, $Min)
EndIf
If $Hour <> @HOUR Then
$Hour = @HOUR
For $i = 0 To $Raggio - 1
$curX = 400 / 2 + Cos($PI / 2 - ($Raggio * ($Hour+$Min/60) / 12 * $PI / ($Raggio / 2))) * $i
$curY = 400 / 2 - Sin($PI / 2 - ($Raggio * ($Hour+$Min/60) / 12 * $PI / ($Raggio / 2))) * $i
GUICtrlSetPos($Raggio_Element_Hour[$i], $curX, $curY)
Next
GUICtrlSetData($Label_Hour, $Hour)
EndIf
WEnd
Func _Start()
For $i = 0 To $Raggio - 1
$Sec = @SEC
$curX = 400 / 2 + Cos($PI / 2 - ($Raggio * $Sec / 60 * $PI / ($Raggio / 2))) * $i
$curY = 400 / 2 - Sin($PI / 2 - ($Raggio * $Sec / 60 * $PI / ($Raggio / 2))) * $i
$Raggio_Element_Sec[$i] = GUICtrlCreateLabel("", $curX, $curY, 1, 1)
GUICtrlSetBkColor(-1, $Color_Sec)
$Min = @MIN
$curX = 400 / 2 + Cos($PI / 2 - ($Raggio * ($Min+$Sec/60) / 60 * $PI / ($Raggio / 2))) * $i
$curY = 400 / 2 - Sin($PI / 2 - ($Raggio * ($Min+$Sec/60) / 60 * $PI / ($Raggio / 2))) * $i
$Raggio_Element_Min[$i] = GUICtrlCreateLabel("", $curX, $curY, 2, 2)
GUICtrlSetBkColor(-1, $Color_Min)
$Hour = @HOUR
$curX = 400 / 2 + Cos($PI / 2 - ($Raggio * ($Hour+$Min/60) / 12 * $PI / ($Raggio / 2))) * $i
$curY = 400 / 2 - Sin($PI / 2 - ($Raggio * ($Hour+$Min/60) / 12 * $PI / ($Raggio / 2))) * $i
$Raggio_Element_Hour[$i] = GUICtrlCreateLabel("", $curX, $curY, 3, 3)
GUICtrlSetBkColor(-1, $Color_Hour)
Next
GUICtrlSetData($Label_Sec, $Sec)
GUICtrlSetData($Label_Min, $Min)
GUICtrlSetData($Label_Hour, $Hour)
EndFunc ;==>_Start