lineto problem/question

Non-platform specific questions.

lineto problem/question

Postby sonicfire » Mon Nov 13, 2006 4:59 pm

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:
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score

Postby makslane » Mon Nov 13, 2006 6:19 pm

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);
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby sonicfire » Mon Nov 13, 2006 7:24 pm

and again : thank you very much! :)
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest