PDA

Click to See Complete Forum and Search --> : Analog Clock


ChimpFace9000
Jun 11th, 2001, 11:36 AM
I wanna make an analog clock in DOS. Nothing fancy, right now, all im trying to do is get just the second hand to go around in a circle. When i get the seconds, itll be a number between 0 and 59, and i know if i multiply it by 6, ill get the degree of where it should be in a 360 degree circle. My problem is, how do i find out where on the screen to draw the seconds hand? I think it has something to do with circles, but im not sure. Any help would be appriciated.

Jimbob42
Jun 15th, 2001, 12:54 AM
div clocks past midnight (int 1a,ax=0 -> cx:dx) by (65536/3600)
then take the remainder of seconds mod 3600
mul by 6 -> turn into degrees
subtract angle from 90° (to turn angle from y-axis into backwards angle from x-axis)
mul by pi/180 to get radians
x=r*cos(angle) 'where r = radius or length of second hand
y=r*sin(angle)
fsincos st(0) does this nicely
and you now have x and y coords to add to the origin
let's say the origin in 320*200 screen is 160,200

line(320,200)-(320+x,200+y) 'or is it -y?