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 > touchRead not working when handling interrupts

#172711 - sylvestersteele - Fri Feb 26, 2010 4:23 am

Hi guys,

I am modifying the homebrew frambuffer tutorial http://double.co.nz/nintendo_ds/nds_develop2.html such that the red rectangle moves to the point that was touched.

Now I've got the example as is to work just fine. But, the touchRead in my main while loop never reads the touched value- always zero. If I put my drawing routines in the while loop (which obviously causes the rectangle to move along really fast) and remove the InitInterruptHandler(); etc.- then a touch is atleast detected. But if I put the InitInterruptHandler(); back in- again no touch.

I was going through previous posts- and I got the feeling that such behaviour is expected. However- those posts did not say how this problem could be solved.

Any ideas?

Thanks,
Sylvester

#172716 - sverx - Fri Feb 26, 2010 11:46 am

sylvestersteele wrote:
If I put my drawing routines in the while loop (which obviously causes the rectangle to move along really fast) and remove the InitInterruptHandler(); etc.- then a touch is atleast detected.


InitInterruptHandler(); has been removed since some time (since libnds 1.3.1, if I'm not mistaken) so don't use it.

To read touch position, do that:
Code:
touchPosition touch; touchRead(&touch);


maybe you can check the 1st example of this page of my tutorial, here (text and code comments are in Italian, but it shouldn't be a big problem...)

#172727 - sylvestersteele - Fri Feb 26, 2010 9:00 pm

#1 That leads to a bigger question then about how vblank or any other interrupts should be handled another way?

#2 Also, this implies that a whole bunch of stuff on that website is outdated. Is there a place where I can find more recent stuff?

Thanks,
Sylvester