10-12-2024, 02:14 PM
Using Goggle-Eyes to tell time!
Code: (Select All)
$Color:32
_Title "Google Time"
dx = _DesktopWidth
dy = _DesktopHeight
Screen _NewImage(dx, dy, 32)
_FullScreen
Do
Cls
Googletime
_Limit 10
_Display
Loop Until _KeyHit
Sub Googletime
t# = Timer + 12 * 3600
h = t# \ 3600
m = (t# - h * 3600) \ 60
s = t# Mod 60
cx = _Width / 2
cy = _Height / 2
EllipseFill _Width \ 4, cy, cx \ 4, cy, White
EllipseFill 3 * _Width \ 4, cy, cx \ 4, cy, White
x = Sin(_D2R(h * 30)) * cx \ 9
y = -Cos(_D2R(h * 30)) * 2 * cy \ 3
EllipseFill _Width \ 4 + x, cy + y, 100, 100, Black
If h > 11 Then
Color Red, 0
_PrintString (_Width \ 4 + x - 8, cy + y - 4), "AM"
Else
Color Blue, 0
_PrintString (_Width \ 4 + x - 8, cy + y - 4), "PM"
End If
x = Sin(_D2R(m * 6)) * cx \ 9
y = -Cos(_D2R(m * 6)) * 2 * cy \ 3
EllipseFill 3 * _Width \ 4 + x, cy + y, 100, 100, Black
x1 = Sin(_D2R(s * 6)) * 30
y1 = -Cos(_D2R(s * 6)) * 30
EllipseFill 3 * _Width \ 4 + x + x1, cy + y + y1, 20, 20, Red
End Sub
Sub EllipseFill (CX As Integer, CY As Integer, a As Integer, b As Integer, C As _Unsigned Long)
' CX = center x coordinate
' CY = center y coordinate
' a = semimajor axis
' b = semiminor axis
' C = fill color
If a = 0 Or b = 0 Then Exit Sub
Dim h2 As _Integer64
Dim w2 As _Integer64
Dim h2w2 As _Integer64
Dim x As Integer
Dim y As Integer
w2 = a * a
h2 = b * b
h2w2 = h2 * w2
Line (CX - a, CY)-(CX + a, CY), C, BF
Do While y < b
y = y + 1
x = Sqr((h2w2 - y * y * w2) \ h2)
Line (CX - x, CY + y)-(CX + x, CY + y), C, BF
Line (CX - x, CY - y)-(CX + x, CY - y), C, BF
Loop
End Sub