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 > Touchscreen Calibration - Console

#39004 - sashswash - Sun Apr 03, 2005 2:12 am

Hey Guys -

I'm new to the DS/GBA developing scene, but so far i'm working on developing a simple keyboard / button interface. I am using the console functions, and a button class i created, to place "buttons" on screen. The problem that i am having is lining up the buttons with where the touchscreen reads the input (it is a calibration issue). Here is some code:

typedef struct {int x,y;} COORD; // A coordinate structure
COORD temp;
temp.y = (IPC->touchY)/193;

the '/193' for the temp.y value seems to produce the most accurate results. However, because i am using division, the amount of error in the calculation increases as i move the stylus down the screen. Do you guys have any suggestions or examples of calibration code?

Basically, i need to divide the touchscreen into a grid of 32x24 "touch areas".

#39018 - Darkain - Sun Apr 03, 2005 5:36 am

http://www.bottledlight.com/ds/index.php/Misc/TouchScreen

the code that i came up with is at the very bottom of the page.


and just in case you dont have min/max...

Code:
#define max(a,b)  (((a) > (b)) ? (a) : (b))
#define min(a,b)  (((a) < (b)) ? (a) : (b))

_________________
-=- Darkain Dragoon -=-
http://www.darkain.com
DarkStar for Nintendo DS