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 > Plotting individual pixels?

#136670 - calcprogrammer1 - Fri Aug 03, 2007 6:31 pm

Is there a way (preferably in PAlib, but libnds is OK as long as there's documentation) to plot directly to the screen, like, just turn one pixel on or off, set color, etc? I want something that draws lines to the screen, and plotting pixels seems easier than preset sprites...I heard about some kind of framebuffer mode in libnds, but I have no clue how to use it.

Where can I find general libnds documentation, anyways? I'd like to read a command reference of it or something, if one's available.
_________________
DS Firmware 1, Datel Games n' Music card / Chism's FW hacked GBA MP v2 CF

There's no place like 127.0.0.1.

#136671 - Sunray - Fri Aug 03, 2007 6:40 pm

Yes there is a framebuffer mode. Extended rotation is similar to the framebuffer mode but offers extra features like rotation and scaling.

A third way is to draw hardware accelerated lines using a 3D background. If you draw a triangle where two vertices are equal, a line will be drawn instead.

#136672 - calcprogrammer1 - Fri Aug 03, 2007 6:45 pm

Ok, that's good, now I know that it is possible, but what libraries support these functions...are there any command references or tutorials for this?
_________________
DS Firmware 1, Datel Games n' Music card / Chism's FW hacked GBA MP v2 CF

There's no place like 127.0.0.1.

#136682 - LiraNuna - Fri Aug 03, 2007 8:56 pm

Quote:
Where can I find general libnds documentation, anyways? I'd like to read a command reference of it or something, if one's available.

"libnds" has no documentations, only a set of defines and helper functions.
for frame buffer, or as called "extended roto-scale background".

Too lazy to comment the code:
Code:

static inline void putPixel(u8 x, u8 y, u16 col) {
   BG_GFX[x + (y << 8)] = col | (1<<15);
}

void initVideo()
{
   POWER_CR = POWER_ALL_2D;
   DISPLAY_CR = MODE_5_2D | DISPLAY_BG3_ACTIVE;
   VRAM_A =VRAM_ENABLE | 1;
   BG3_CR = BG_BMP8_256x256;
   BG3_XDX = 256;
   BG3_YDY = 256;
}

_________________
Private property.
Violators will be shot, survivors will be shot again.

#136684 - LiraNuna - Fri Aug 03, 2007 8:57 pm

LiraNuna wrote:
Quote:
Where can I find general libnds documentation, anyways? I'd like to read a command reference of it or something, if one's available.

"libnds" has no documentations, only a set of defines and helper functions.
for frame buffer, or as called "extended roto-scale background".

Too lazy to comment the code:
Code:
static inline void putPixel(u8 x, u8 y, u16 col) {
   BG_GFX[x + (y << 8)] = col | (1<<15);
}

void initVideo()
{
   POWER_CR = POWER_ALL_2D;
   DISPLAY_CR = MODE_5_2D | DISPLAY_BG3_ACTIVE;
   VRAM_A =VRAM_ENABLE | 1;
   BG3_CR = BG_BMP8_256x256;
   BG3_XDX = 256;
   BG3_YDY = 256;
}

_________________
Private property.
Violators will be shot, survivors will be shot again.

#136710 - mastertop101 - Sat Aug 04, 2007 12:18 am

it's super easy with libnds and even easier in palib (bitmap modes / framebuffer mode).. Can't you search a bit ? THere's plenty of palib documentation and tutorials.