Draw line function?

Hello everyone! :smiley:

Hey, what’s an easy function to draw a line from one point to another in
a surface? I’m on Lua so I can’t use additional SDL libraries like
SDL_draw. :frowning:

Thanks! :wink:

L-28C wrote:

Hello everyone! :smiley:
Hey, what’s an easy function to draw a line from one point to another in
a surface? I’m on Lua so I can’t use additional SDL libraries like
SDL_draw. :frowning:

Depends on what kind of speed, quality and features you are
looking for… you might want to look around libsdl.org.–
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia

I just want something that’ll draw white pixels between 2 points…
Nothing fancy. :stuck_out_tongue:

Speed shouldn’t be an issue here. Thanks! :wink:

Kein-Hong Man wrote:> L-28C wrote:

Hello everyone! :smiley:
Hey, what’s an easy function to draw a line from one point to another in
a surface? I’m on Lua so I can’t use additional SDL libraries like
SDL_draw. :frowning:

Depends on what kind of speed, quality and features you are
looking for… you might want to look around libsdl.org.

Drawing a simple line is pretty complicated actually!> ----- Original Message -----

From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of L-28C
Sent: Tuesday, February 20, 2007 7:12 PM
To: sdl at libsdl.org
Subject: Re: [SDL] Draw line function?

I just want something that’ll draw white pixels between 2 points…
Nothing fancy. :stuck_out_tongue:

Speed shouldn’t be an issue here. Thanks! :wink:

Kein-Hong Man wrote:

L-28C wrote:

Hello everyone! :smiley:
Hey, what’s an easy function to draw a line from one point to another in
a surface? I’m on Lua so I can’t use additional SDL libraries like
SDL_draw. :frowning:

Depends on what kind of speed, quality and features you are
looking for… you might want to look around libsdl.org.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Drawing a simple line is pretty complicated actually!

True, and doubly so in Lua.

There isn’t a line drawing function in SDL…you’d have to touch the
pixels directly…I’m not sure if that’s possible from Lua.

–ryan.

Google for “Bresenham’s algorithm”.On Tue February 20 2007 18:55, L-28C wrote:

Hello everyone! :smiley:

Hey, what’s an easy function to draw a line from one point to another in
a surface? I’m on Lua so I can’t use additional SDL libraries like
SDL_draw. :frowning:

Thanks! :wink:


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

There isn’t a line drawing function in SDL…you’d have to touch the
pixels directly…I’m not sure if that’s possible from Lua.

If speed isn’t an issue, you can SDL_FillRect with width and height of
one.–
Jukka-Pekka Manninen

SDL_gfx is the way you want to go.

http://www.ferzkopp.net/joomla/content/view/19/14/

SDL itself does not have line drawing primitives. My Lua/SDL binding
(which was part of LuaX) actually had SDL_gfx ‘built-in’ for this
reason. And I do have one extensive demo app which exercises the
primitives.

The binding can either be used with the custom LuaX distro, or recent
code can be compiled for stock Lua but there is no such distribution
out, yet. I am waiting for a CPAN-kind module deployment framework
for Lua.

Give me a line if interested, I’ll help you get SDL_gfx rolling. :slight_smile:

There’s actually a video of SDL_gfx on PocketPC here:
http://kotisivu.dnainternet.fi/askok/luax/luax/video1.html )

-asko

L-28C kirjoitti 21.2.2007 kello 4.55:> Hello everyone! :smiley:

Hey, what’s an easy function to draw a line from one point to
another in
a surface? I’m on Lua so I can’t use additional SDL libraries like
SDL_draw. :frowning:

Thanks! :wink:


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org