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.

Coding > Drawing on two screens

#172331 - ImacNds - Mon Feb 01, 2010 10:47 am

Hi.
I already appologize for my english (as a french).

I have almost finished a mario-like game with the libnds (I'll finish and the end of the week, I hope), but I'm stuck on a problem.
I would like to draw on both screens, at the same time. Like drawing my game on the bottom; and on the top the progression, the number of pieces, etc, with a nice .
I've found nothing on the Web which explains "how it works".
I've just the functions in the "includes", like "lcdMainOnBottom", or "lcdSwap", but they don't help me, because they don't seem to permit me to write on both screen, they just "swap" the printing.

Could you please help me ?
Thank you in advance,

#172332 - Ruben - Mon Feb 01, 2010 11:55 am

Well, just as a side note, I would rather have the game on top and stats on bottom; most games do that, anyway.

As to your question: I'm not sure because I don't use libnds, but I think there should be REG_x_A and REG_x_B for both LCDs. Commonly you'd want to swap the LCDs as LCD A is actually the *bottom* LCD, not the top so it gets a bit confusing.

#172333 - ImacNds - Mon Feb 01, 2010 12:13 pm

Thanks for your answer.
You're right, but the game is playable with the stylus, that's why the main is on bottom.
I'm gonna look about "REG_x_A and REG_x_B for both LCDs", but I'm not sure that it is what I need.

Does someone have an idea ? :)

#172334 - Ruben - Mon Feb 01, 2010 1:25 pm

Well, as you said you wanted to draw on both screens, the registers *are* REG_x_A/B, but I'm pretty sure libnds has API code for it, so you would have to ask/look for someone who knows about libnds.
Source: GBATek, NDS section

#172335 - Drovor - Mon Feb 01, 2010 1:41 pm

libnds makes it so writing to the sub screen similar to the main screen.

Instead of "videoSetMode" initialize the sub screen with "videoSetModeSub", instead of copying backgrounds to "BG_BMP_RAM" copy to "BG_BMP_RAM_SUB", instead of copying sprites to "SPRITE_GFX" copy to "SPRITE_GFX_SUB", etc...

There are limitations on the sub screen, it cannot do 3D or framebuffer mode (without special tricks). There are many examples of using both screens in the examples that come with devkitPro: http://sourceforge.net/projects/devkitpro/files/

#172336 - ImacNds - Mon Feb 01, 2010 1:50 pm

Thank you very much for having clarified the problem :) .
I'm gonna look on these libnds examples, and ask in a nds forum if I don't succed.
Sorry for the inconveniance, and have a nice day.