[futurebasic] Re: [FB] moving the origin

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : March 2002 : Group Archive : Group : All Groups

From: Jay <jktr@...>
Date: Mon, 25 Mar 02 13:05:47 -0600
>‘ WINDOW 1, "My Clock",(0,0)-(200,200)
>‘ CALL SETORIGIN(-100,-100),
>
>the origin is in the middle of the window, but I can see only the
>right-down quarter).
>
>Why I must write (-100,-100) and not (100,100)?
>I need a statement that can moves the origin to (100,100) and when I
>want to draw the circle <<CIRCLE 0,0,70>>, in the middle of the window,
>in clockwise, not in a trigonometric one, not only a quarter of it.
>
>
>I write the begining of my program:

Eugen,

You are very close, but I think SETORIGIN is not what you want. I made a few small changes in your code... Take a look at this:

dim gTime$

LOCAL FN ClockWindow
WINDOW 1, "A clock",(0,0)-(200,200),_docRound,_clickThru
COORDINATE WINDOW
edit field 1,,(0,180)-(200,200),_statNoFramed,_centerJust
END FN

LOCAL FN DrowingTheClock
dim i%,za!
FOR I%=0 TO 60
za!=PI*I%/30
CIRCLE 100+70*SIN(za!), 100+70*COS(za!),1
NEXT I%
FOR I%=0 TO 60 STEP 5
za!=PI*I%/30
CIRCLE 100+70*SIN(za!), 100+70*COS(za!),2
NEXT I%
END FN

LOCAL FN SecondsHand
dim sec%,secalfaX!
'Erase second hand
sec%=VAL(RIGHT$(gtime$,2))-15
secalfaX!=PI*sec%/30
color _zWhite
PLOT 100,100 TO 100+67*COS(secalfaX!), 100+67*SIN(secalfaX!)
'Draw new second hand
color _zBlack
gtime$=TIME$
edit field 1, gtime$
sec%=VAL(RIGHT$(gtime$,2))-15
secalfaX!=PI*sec%/30
PLOT 100,100 TO 100+67*COS(secalfaX!), 100+67*SIN(secalfaX!)
END FN

FN ClockWindow
FN DrowingTheClock

DO
if gTime$ <> time$ then FN SecondsHand
HANDLEEVENTS
UNTIL 0


 e-e
 =J= a  y
  "