%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Clock Program
% By: Santabruzer
% For: Ms. White
% Date: December 2nd, 2003
% Filename: clockmz.t
% Purpose - This program inputs the time the computer is set to
% the processing is the drawing of the clock and calculating the
% location of the hands, and the output is handy clock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ======================== Configuration ======================== %
var background : int := 1 % Set the BackGround Color you want
var whiteorblack : int := 1 % Set 0 for white, any other number
% will be black
var font := Font.New ("verdana:12:bold") % Change the Font
% =============== Do Not Modify Below this Point ================ %
% Setting Screens
setscreen ("graphics:320;320")
setscreen ("offscreenonly")
% Variable Declaration
% --------------------------------------------------------------- %
var timenow, temp, ampm : string
var ox, oy, midx, midy : int
var hours, minutes, seconds : int
var y : int := 160
var x : int := 100
% Intialazation of black and white colors for the whiteorblack
% variable
var blac := 7
var whit := 0
% Intialazation of the Midway points
midx := round (maxx / 2)
midy := round (maxy / 2)
% Begin Loop
loop
% Find out the time
time (timenow)
% Set hours, minutes and seconds, from the time
hours := strint (timenow (1 .. 2))
minutes := strint (timenow (4 .. 5))
seconds := strint (timenow (7 .. 8))
% Subtract 60 so that the clock will work clockwise (degrees work
% counter-clockwise)
seconds := 60 - seconds
minutes := 60 - minutes
hours := 24 - hours
% Change clock to AM / PM
temp := timenow (1 .. 2)
if strint (temp) > 12 then
temp := intstr (strint (temp) - 12)
ampm := "PM"
else
ampm := "AM"
end if
% Draw Background
drawfillbox (0, 0, maxx, maxy, background)
% Decision for white or black
if whiteorblack = 1 then
whit := 0
blac := 7
elsif whiteorblack = 0 then
whit := 7
blac := 0
end if
% Drawing of the Clock's Background
drawfilloval (midx, midy, 150, 150, blac)
% Drawing of the lines
drawline (160, 305, 160, 15, whit) % Horizontal
drawline (305, 160, 15, 160, whit) % Vertical
% Drawing of covering circle (used to cover lines)
drawfilloval (midx, midy, 120, 120, blac)
% Drawing of Outline
drawoval (midx, midy, 150, 150, whit)
% Drawing of current digital time (AM/PM)
Font.Draw (temp + timenow (3 .. 8) + " " + ampm, 119, 80, font, whit)
% Drawing of clockhands
drawfillarc (midx, midy, 120, 120, ((seconds) * 6) + 90, ((seconds) * 6 + 1) + 90, 40)
drawfillarc (midx, midy, 90, 90, ((minutes) * 6) + 90, ((minutes) * 6 + 1) + 90, 26)
drawfillarc (midx, midy, 65, 65, ((hours) * 30) + 90, ((hours) * 30 + 1) + 90, 8)
% Drawing axel dot
drawfilloval (midx, midy, 3, 3, whit)
% Updating the sequence
View.Update
cls
end loop
% ======================== Do Not Modify ======================== % |