How Do The Draw Commands Work?


Racemaniac

Scorched GP programmer
Joined
Nov 3, 2003
Messages
587
Website
Visit site
i was just playing with fenix a bit, using the draw_line or so command.
i tried this little process:
Code:
process line(x,y)
begin
	loop
  if(key(_up))
    y--;
  end;
  if(key(_down))
    y++;
  end;
  if(key(_left))
    x--;
  end;
  if(key(_right))
    x++;
  end;
  DELETE_DRAW(0);
  draw_line(160,120,x,y);
  frame;
	end;
end;

whatever i do, the line doesn't change... (if i make the process show it coords on screen, you see them change...)
if i put it like that, a line gets drawn once...
although, some other testing revealed something might be happening to the colors or so, but i can't figure out what's happening here... i already knew the draw commands sucked, but what's this?
 
With draw_line(x1,y1,x2,y2); x2 has to be larger then x1, same with y.

Try this:

Code:
program line;
 private
   drawn; 
   fix_x=0;
   fix_y=0;
   
 begin
   set_mode(320,240,16);      
   x=10; y=10;
   loop        
     if(key(_up))y--;end;
     if(key(_down))y++;end;
     if(key(_left))x--;end;
     if(key(_right))x++;end;
     
     delete_draw(drawn);
     drawing_color(-1);
     draw_line(fix_x,fix_y,x,y);
     frame;
    end;
  end;

Then it works.

EDIT1:
Oh yeah, and for me, the line was painted black, no matter of what drawing_color I set, so I just made the background blue :D

EDIT2:
Hmm, delete_draw seems to set the drawing_color back to black, I`ll update my example :D
 
Back
Top