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 > touchpad input demo? please!

#160314 - Holland - Sun Jul 13, 2008 11:21 pm

i've used the touchpad to select things and drag stuff around, but now i'm needing to draw lines. i'm noticing that the refresh rate is making this a little difficult.

i'm assuming it's an issue of not using a backbuffer...but i'm having a hard time finding a good tutorial for backbuffering..and more specifically drawing lines with it.

i'm going to be displaying sprites on top of the surface the lines are drawn on..but i'm assuming that can be handled by just setting the priority in the BG Control registers.

if i remember correctly from GBA dev, there is a mode with a backbuffer, but i wasn't using any sort of library when i was doing gba stuff.
any help or even just a quick and dirty demo app or anything would be greatly appreciated.

#160315 - dovoto - Sun Jul 13, 2008 11:36 pm

I seem to remember talking about that sort of thing here:

http://www.dev-scene.com/NDS/Tutorials_Day_3

Maybe not exactly what you need but should be a start.
_________________
www.drunkencoders.com

#160319 - Holland - Mon Jul 14, 2008 12:32 am

yeah..i've been messing around with those. the drawing one you provide is great until you add in a waitvblank...then it doesn't update fast enough. trying to swap it over to be double buffered like your double buffer tutorial...but i'm having issues just because your double buffering is done with bitmaps...i'm just trying to change individual pixel colors.

is there anywhere i can just get a memory layout like cowbite has for the GBA? i'm trying to learn how to use libnds but i'm thinking i might be better off just understanding what register everything is writing to and such...since that's the only way i know how to code for the GBA.

#160320 - Lazy1 - Mon Jul 14, 2008 12:51 am

Holland wrote:

is there anywhere i can just get a memory layout like cowbite has for the GBA? i'm trying to learn how to use libnds but i'm thinking i might be better off just understanding what register everything is writing to and such...since that's the only way i know how to code for the GBA.


GBATek

#160322 - Holland - Mon Jul 14, 2008 12:57 am

Lazy1 wrote:
Holland wrote:

is there anywhere i can just get a memory layout like cowbite has for the GBA? i'm trying to learn how to use libnds but i'm thinking i might be better off just understanding what register everything is writing to and such...since that's the only way i know how to code for the GBA.


GBATek


thank you so much!!

#160330 - Holland - Mon Jul 14, 2008 3:12 am

so i'm starting to notice some things that confuse me.

when you set up the display control register and pass in MODE_FB# it's sending in 0x00020000 or 0x00060000 etc...

according to the specs i'm seeing there are only 16 bits in the display control...so what are these doing?

#160332 - dovoto - Mon Jul 14, 2008 3:30 am

Holland wrote:
so i'm starting to notice some things that confuse me.

when you set up the display control register and pass in MODE_FB# it's sending in 0x00020000 or 0x00060000 etc...

according to the specs i'm seeing there are only 16 bits in the display control...so what are these doing?


Sure you are not looking at gba specs?

http://nocash.emubase.de/gbatek.htm#dsvideobgmodescontrol <--try that
_________________
www.drunkencoders.com

#160333 - Holland - Mon Jul 14, 2008 3:31 am

dovoto wrote:
Holland wrote:
so i'm starting to notice some things that confuse me.

when you set up the display control register and pass in MODE_FB# it's sending in 0x00020000 or 0x00060000 etc...

according to the specs i'm seeing there are only 16 bits in the display control...so what are these doing?


Sure you are not looking at gba specs?

http://nocash.emubase.de/gbatek.htm#dsvideobgmodescontrol <--try that


<- moron. you'll learn this over time. :) haha..thanks mate

edit: i think i may strip out all of the GBA info from this htm...i'd prefer tonc and cowbite for that anyway. might be a good way to avoid confusion in the future

#160339 - Holland - Mon Jul 14, 2008 4:40 am

if anyone cares i just split up the gbatek doc and fixed all of the links and such...it's better than confusing stuff like i just did by accident :/

http://www.mediafire.com/?gls0rdyho2p

#160343 - Cydrak - Mon Jul 14, 2008 9:57 am

Holland wrote:
if anyone cares i just split up the gbatek doc and fixed all of the links and such...it's better than confusing stuff like i just did by accident :/

Keep in mind you'll still need the GBA specs--a ton of registers have barely changed from the GBA so they've just been linked from the DS section. It is confusing, I know... Expect to spend some days reading to find all the little details. And don't be afraid to take notes/make your own "cheat sheets"/etc. :-)

Holland wrote:
when you set up the display control register and pass in MODE_FB# it's sending in 0x00020000 or 0x00060000 etc...

Beware that MODE_FB* is quite different from the MODE_n_2D constants or the GBA modes. Essentially, it displays VRAM while normal rendering continues in the background--BG and sprites exist but you won't see them. Also, the FB modes are main screen only.

To draw without losing all the cool features, you can use a BG bitmap instead. For this you'll need:

- Some VRAM assigned as BG (instead of LCD).
- Layer MODE_3_* (for BG3) or MODE_5_* (for BGs 2 and 3).
- A BG mode like BG_BMP16_256x256 with the desired BG_BMP_BASE (if > 0).
- If using BG_BMP8, a suitable BG_PALETTE.
- A matrix. Like the GBA's, these are affine BGs, so you need to set that up as normal. It's pretty straightforward, see the libnds 16bit_color_bmp example.

Alternately, the 3D can render limited amounts of geometry (lines included).

#160348 - Holland - Mon Jul 14, 2008 1:48 pm

Cydrak wrote:
Holland wrote:
if anyone cares i just split up the gbatek doc and fixed all of the links and such...it's better than confusing stuff like i just did by accident :/

Keep in mind you'll still need the GBA specs--a ton of registers have barely changed from the GBA so they've just been linked from the DS section.


which is exactly why i made sure the index.htm could link to both the GBA and NDS portion of the specs... now it's still easy to get between the two but there won't be any more confusion about which one you're looking at.

Cydrak wrote:
Holland wrote:
when you set up the display control register and pass in MODE_FB# it's sending in 0x00020000 or 0x00060000 etc...

Beware that MODE_FB* is quite different from the MODE_n_2D constants or the GBA modes. Essentially, it displays VRAM while normal rendering continues in the background--BG and sprites exist but you won't see them. Also, the FB modes are main screen only.


yeah...now that i have an easy way to see what each function is doing, i realized that MODE_FB* is completely different from setting up a MODE_n_2D and enabling various backgrounds.

thanks for all the input. i love this forum! :D