gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Drawing a line

#43975 - iainprice - Sat May 28, 2005 9:20 pm

Is there an nice way just to draw a line...rather than making it a sprite?

#43983 - josath - Sat May 28, 2005 10:07 pm

this is a popular algorithm for drawing lines
http://www.google.com/search?hl=en&q=bresenham+line

#43984 - iainprice - Sat May 28, 2005 10:18 pm

So, is there a nice putpixel command?

#43985 - DekuTree64 - Sat May 28, 2005 10:25 pm

Usually it's pretty hard to draw lines on GBA/DS though, since you don't have a linear framebuffer most of the time. Possible by using bitmap mode, or by drawing to a BG or sprite and working out the coordinates in the char data, but most often avoided.

Less of a problem on DS though, since you can mix bitmap and text layers.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#43990 - josath - Sat May 28, 2005 11:01 pm

iainprice wrote:
So, is there a nice putpixel command?

Use FB (framebuffer mode) or one of the bitmapped layers / modes. Then just set the values directly in vram