Results 1 to 2 of 2

Thread: Analog Clock

  1. #1
    ChimpFace9000
    Guest

    Post Analog Clock

    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.

  2. #2
    Junior Member
    Join Date
    Jun 2000
    Posts
    28
    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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width