DIM SHARED hourgear
, minutegear
, secondgear
, center
DIM SHARED Cour24
, Cour30
, OE48
, OE18
'shared fonts
PRINT "Initializing clock..."
hourgear = DrawHourGear(&HFFFF00FF)
minutegear = DrawMinuteGear(&HFFFFFF00)
secondgear = DrawSecondGear(&HFF00FF00)
center = CenterDisplay
ManualAdjustment
A = 1
Adjustment = 0
CASE 19200, 20480 'left / down Adjustment = Adjustment - A
CASE 18332, 19712 'up / right Adjustment = Adjustment + A
SUB AssembleClock
(x1
, y1
, x2
, y2
)
hour = t## \ 3600
minute = (t## - hour * 3600) \ 60
second = t## - hour * 3600 - minute * 60
DisplayImage hourgear, 240, 240, hour * 30, 0
DisplayImage minutegear, 240, 240, minute * 6, 0
DisplayImage secondgear, 240, 240, second * 6, 0
center = CenterDisplay
DisplayImage center, 240, 240, 0, 0
_PUTIMAGE (x1
, y1
)-(x2
, y2
), tempimage
, d
, (0, 0)-(479, 479)
CASE "01": month$
= "JAN" CASE "02": month$
= "FEB" CASE "03": month$
= "MAR" CASE "04": month$
= "APR" CASE "05": month$
= "MAY" CASE "06": month$
= "JUN" CASE "07": month$
= "JUL" CASE "08": month$
= "AUG" CASE "09": month$
= "SEP" CASE "10": month$
= "OCT" CASE "11": month$
= "NOV" CASE "12": month$
= "DEC"
IF oldmm
<> mm
THEN 'try to update the weather every minute day$ = GetDay$(mm, dd, yy)
IF Cour30
> 0 THEN SafeLoadFont Cour30
ELSE SafeLoadFont
16 day$ = "Wednesday"
rss$ = DownloadRSS("http://rss.wunderground.com/q/zmw:24138.1.99999", 5)
'<meta property="og:title" content="Pilot, VA | 37.2° | Overcast" />
t$
= "<meta property=" + CHR$(34) + "og:title" + CHR$(34) + " content=" + CHR$(34) endl
= INSTR(l
, rss$
, "/>") temp$
= MID$(rss$
, l
+ LEN(t$
), endl
- l
) ss
= INSTR(fs
+ 1, temp$
, "|") city$
= LEFT$(temp$
, fs
- 1) condition$
= MID$(temp$
, ss
+ 1, el
- ss
- 1) PRINT city$; temp; condition$;
oldmm = mm
CircleFill W, h, R, Kolor
X
= W
+ R
* .9 * COS(_D2R(i
* 30 - 90)) Y
= h
+ R
* .9 * SIN(_D2R(i
* 30 - 90)) tempimage = TextToImage&(t$, OE48, &HFF000000, 0, 0)
DisplayImage tempimage, X, Y, -i * 30, 0
'CircleFill W, H, 10, &HFF000000
CircleFill W, h, R, Kolor
X
= W
+ R
* .9 * COS(_D2R(i
* 6 - 90)) Y
= h
+ R
* .9 * SIN(_D2R(i
* 6 - 90)) tempimage = TextToImage&(t$, OE18, &HFF000000, 0, 0)
DisplayImage tempimage, X, Y, -i * 6, 0
X
= W
+ R
* .8 * COS(_D2R(i
* 6 - 90)) Y
= h
+ R
* .8 * SIN(_D2R(i
* 6 - 90)) tempimage = TextToImage&(t$, OE18, &HFF000000, 0, 0)
DisplayImage tempimage, X, Y, -i * 6, 0
'CircleFill W, H, 10, &HFF000000
CircleFill W, h, R, Kolor
X
= W
+ R
* .9 * COS(_D2R(i
* 6 - 90)) Y
= h
+ R
* .9 * SIN(_D2R(i
* 6 - 90)) tempimage = TextToImage&(t$, OE18, &HFF000000, 0, 0)
DisplayImage tempimage, X, Y, -i * 6, 0
X
= W
+ R
* .8 * COS(_D2R(i
* 6 - 90)) Y
= h
+ R
* .8 * SIN(_D2R(i
* 6 - 90)) tempimage = TextToImage&(t$, F, &HFF000000, 0, 0)
DisplayImage tempimage, X, Y, -i * 6, 0
'CircleFill W, H, 10, &HFF000000
' CX = center x coordinate
' CY = center y coordinate
' R = radius
' C = fill color
RadiusError = -Radius
X = Radius
Y = 0
LINE (CX
- X
, CY
)-(CX
+ X
, CY
), C
, BF
RadiusError = RadiusError + Y * 2 + 1
LINE (CX
- Y
, CY
- X
)-(CX
+ Y
, CY
- X
), C
, BF
LINE (CX
- Y
, CY
+ X
)-(CX
+ Y
, CY
+ X
), C
, BF
X = X - 1
RadiusError = RadiusError - X * 2
Y = Y + 1
LINE (CX
- X
, CY
- Y
)-(CX
+ X
, CY
- Y
), C
, BF
LINE (CX
- X
, CY
+ Y
)-(CX
+ X
, CY
+ Y
), C
, BF
'Image is the image handle which we use to reference our image.
'x,y is the X/Y coordinates where we want the image to be at on the screen.
'angle is the angle which we wish to rotate the image.
'mode determines HOW we place the image at point X,Y.
'Mode 0 we center the image at point X,Y
'Mode 1 we place the Top Left corner of oour image at point X,Y
'Mode 2 is Bottom Left
'Mode 3 is Top Right
'Mode 4 is Bottom Right
px(0) = -w \ 2: py(0) = -h \ 2: px(3) = w \ 2: py(3) = -h \ 2
px(1) = -w \ 2: py(1) = h \ 2: px(2) = w \ 2: py(2) = h \ 2
px(0) = 0: py(0) = 0: px(3) = w: py(3) = 0
px(1) = 0: py(1) = h: px(2) = w: py(2) = h
px(0) = 0: py(0) = -h: px(3) = w: py(3) = -h
px(1) = 0: py(1) = 0: px(2) = w: py(2) = 0
px(0) = -w: py(0) = 0: px(3) = 0: py(3) = 0
px(1) = -w: py(1) = h: px(2) = 0: py(2) = h
px(0) = -w: py(0) = -h: px(3) = 0: py(3) = -h
px(1) = -w: py(1) = 0: px(2) = 0: py(2) = 0
sinr
= SIN(angle
/ 57.2957795131): cosr
= COS(angle
/ 57.2957795131) x2 = (px(i) * cosr + sinr * py(i)) + x: y2 = (py(i) * cosr - px(i) * sinr) + y
px(i) = x2: py(i) = y2
_MAPTRIANGLE (0, 0)-(0, h
- 1)-(w
- 1, h
- 1), Image
TO(px
(0), py
(0))-(px
(1), py
(1))-(px
(2), py
(2)) _MAPTRIANGLE (0, 0)-(w
- 1, 0)-(w
- 1, h
- 1), Image
TO(px
(0), py
(0))-(px
(3), py
(3))-(px
(2), py
(2))
'text$ is the text that we wish to transform into an image.
'font& is the handle of the font we want to use.
'fc& is the color of the font we want to use.
'bfc& is the background color of the font.
'Mode 1 is print forwards
'Mode 2 is print backwards
'Mode 3 is print from top to bottom
'Mode 4 is print from bottom up
'Mode 0 got lost somewhere, but it's OK. We check to see if our mode is < 1 or > 4 and compensate automatically if it is to make it one (default).
'print the text lengthwise
'print the text vertically
'Print text forward
'Print text backwards
temp$ = ""
temp$
= temp$
+ MID$(text$
, LEN(text$
) - i
, 1) 'Print text upwards
'first lets reverse the text, so it's easy to place
temp$ = ""
temp$
= temp$
+ MID$(text$
, LEN(text$
) - i
, 1) 'then put it where it belongs
fx
= (w&
- _PRINTWIDTH(MID$(temp$
, i
, 1))) / 2 + .99 'This is to center any non-monospaced letters so they look better 'Print text downwards
fx
= (w&
- _PRINTWIDTH(MID$(text$
, i
, 1))) / 2 + .99 'This is to center any non-monospaced letters so they look better
FUNCTION GetDay$
(mm
, dd
, yyyy
) 'use 4 digit year 'From Zeller's congruence: https://en.wikipedia.org/wiki/Zeller%27s_congruence
IF mm
< 3 THEN mm
= mm
+ 12: yyyy
= yyyy
- 1 zerocentury = yyyy \ 100
result
= (dd
+ INT(13 * (mm
+ 1) / 5) + century
+ INT(century
/ 4) + INT(zerocentury
/ 4) + 5 * zerocentury
) MOD 7 CASE 0: GetDay$
= "Saturday" CASE 1: GetDay$
= "Sunday" CASE 2: GetDay$
= "Monday" CASE 3: GetDay$
= "Tuesday" CASE 4: GetDay$
= "Wednesday" CASE 5: GetDay$
= "Thursday" CASE 6: GetDay$
= "Friday"
'Safely loads a font without destroying our current print location and making it revert to the top left corner.
right
= (right
- 1) * _PRINTWIDTH(" ") 'convert the monospace LOC to a graphic X coordinate right
= (right
/ _PRINTWIDTH(" ")) + 1 'convert the graphic X coordinate back to a monospace LOC column
link$ = url$
e$
= CHR$(13) + CHR$(10) ' end of line characters x$ = "GET " + url3$ + " HTTP/1.1" + e$
x$ = x$ + "Host: " + url2$ + e$ + e$
head$ = ""
cont_type$ = ""
DownloadRSS$ = final$