Page 1 of 1

lineto problem/question

PostPosted: Mon Nov 13, 2006 4:59 pm
by sonicfire
do lineto and pixel drawing operations only work within canvas actors?
cant i just create a normal actor and let him draw a line??

i tried this within a normal actor:

Code: Select all
(Draw Actor:)

moveto(xscreen,yscreen); // or just x, y??
setpen(255,255,255,0,2);
lineto(0,128);


Shouldn´t this draw a line from the actor position down 128 pixels? :?
I cant see any line :cry:

PostPosted: Mon Nov 13, 2006 6:19 pm
by makslane
You can only use canvas actors.
The coordinates are relative to the actor, so, if you need to draw something in screen coordinate, like the mouse position, use the screen_to_actor function:

Draw a vertical white line:

Code: Select all
setpen(255,255,255,0,2);
moveto(0, 0); //Left up corner
lineto(0,128);


Draw a white point at mouse coordinates:

Code: Select all
setpen(255,255,255,0,2);
screen_to_actor(&xmouse,&ymouse); //get mouse coordinates
moveto(xmouse,ymouse); //move pen to mouse coordinates
lineto(xmouse, ymouse);

PostPosted: Mon Nov 13, 2006 7:24 pm
by sonicfire
and again : thank you very much! :)