|
Okay, so you learned how to get input from the buttons
on Day 2, now let's learn how to get input from the stylus, or touch
screen. Heck, the touch screen is what sets the DS apart from
other video game systems, so we have to find a way to use it in our
game/application!
|
// Includes #include <PA9.h> // Include for PA_Lib
// Function: main() int main(int argc, char ** argv) { PA_Init(); PA_InitVBL();
//PA_LoadSplash();
PA_InitText(1, 0); PA_InitText(0, 0);
PA_SetTextCol(1, 31, 31, 31); PA_SetTextCol(0, 0, 0, 31);
PA_OutputSimpleText(1, 0, 0, "Test Out The Stylus");
// Infinite loop to keep the program running while (1) { if (Stylus.Held) { // Stylus is touching the screen PA_OutputText(0, 0, 5, "Stylys X Coordinate: %d", Stylus.X); PA_OutputText(0, 0, 7, "Stylus Y Coordinate: %d", Stylus.Y); } else { // Stylus is not touching the screen PA_OutputText(0, 0, 5, "Touch the screen "); PA_OutputText(0, 0, 7, " "); }
PA_WaitForVBL(); }
return 0; } // End of main()
|