Post Reply 
Programming problem with graphics
11-21-2014, 01:30 PM (This post was last modified: 11-21-2014 01:32 PM by ww63.)
Post: #1
Programming problem with graphics
Hello i've tried a short Programm, to display a analog clock on the screen:

Code:

#pragma mode( separator(.,;) integer(h32) )
EXPORT Uhr()
BEGIN
  LOCAL Tm,Hr,Mn,Sc,Mm,Ll;
  RECT(G0);
  REPEAT
    Tm := approx(Time);
    Hr := 2*π*(Tm MOD 12)/12;
    Mn := FP(Tm)*60;
    Sc := FP(Mn)*60;
    RECT(G1);
    FOR Mm FROM 0 TO 59 STEP 1 DO
      IF Mm MOD 5 == 0 THEN
        Ll := 8;
      ELSE
        Ll := 4;
      END;
      LINE_P(G1,ROUND(160+SIN(2*π*Mm/60)*(120-Ll),0),ROUND(120-COS(2*π*Mm/60)*(120-Ll),0),ROUND(160+SIN(2*π*Mm/60)*(120),0),ROUND(120-COS(2*π*Mm/60)*(120),0),RGB(192,192,192))
    END;

    LINE_P(G1,160,120,ROUND(160+SIN(Hr)*60,0),ROUND(120-COS(Hr)*60,0),RGB(0,0,0));
    LINE_P(G1,160,120,ROUND(160+SIN(2*π*Mn/60)*80,0),ROUND(120-COS(2*π*Mn/60)*80,0),RGB(0,0,255));
    LINE_P(G1,160,120,ROUND(160+SIN(2*π*Sc/60)*100,0),ROUND(120-COS(2*π*Sc/60)*100,0),RGB(255,0,0));
    BLIT_P(G0,0,0,320,240,G1,0,0,320,240); 
  UNTIL GETKEY ≥ 0;
  FREEZE; 
END;

but it won't display anything.

Edit: first it has dipslayed the clock, but after a few tries and minor changes it stopped working.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Programming problem with graphics - ww63 - 11-21-2014 01:30 PM



User(s) browsing this thread: 1 Guest(s)