Post Reply 
[Request] drawing a dinamic line
07-10-2014, 08:21 PM
Post: #4
RE: [Request] drawing a dinamic line
Well, you can use G0 and/or a condition to avoid unnecessary redraws:

Code:
export Mes()
BEGIN
  LOCAL m,m1,m2,mx,my,mxi,myi,A;
  LOCAL p1:=0,p2:=0,p3:=0,p4:=0,o1:=-1,o2:=-1,o3:=-1,o4:=-1;
  RECT(RGB(252,252,200));
  DIMGROB_P(G2,340,240,RGB(252,252,200,128));
  DIMGROB_P(G3,340,240,RGB(252,252,200,128));
  ARC_P(G3,160,105,85,0,360);
  blit(G3);
  
WHILE MOUSE(1)≥0 DO END;
REPEAT
  REPEAT
    m:=MOUSE;
    m1:=B→R(m(1));
    m2:=B→R(m(2));
    
  UNTIL SIZE(m1)>0;
  
  mx:=m1(1);
  my:=m1(2);
  mxi:=m1(3);
  myi:=m1(4);
  
  if m1(5)==#2d then  A:=(mx-mxi); END;
  
  p1:=161+85*COS(A);
  p2:=106+85*SIN(A);
  p3:=161-85*COS(A);
  p4:=106-85*SIN(A);
  
  if p1<>o1 then
    LINE_P(G0,o1,o2,o3,o4,RGB(252,252,200));
    LINE_P(G0,p1,p2,p3,p4,RGB(0,0,255));
    o1:=p1;o2:=p2;o3:=p3;o4:=p4;
  end;
  //TEXTOUT_P(A,G0,20,208,2,RGB(255,0,0));
  //BLIT(G2);
UNTIL my>220 ;
END;

My website: ried.cl
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
[Request] drawing a dinamic line - fabila - 07-10-2014, 06:03 PM
RE: [Request] drawing a dinamic line - eried - 07-10-2014 08:21 PM



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