Yes way. In case you have not yet noticed, the 3DS Paint app now works on iPod touch and iPhone. Needless to say, it works better than the 3DS itself as far as drawing reaches.
In the past, if you tried to draw with the iPod, it would do nothing but move with your finger. Now the screen stays as still as ever with this new piece of coding, and allows you to paint your pretty picture.
This morning, my good friend Jailiene asked if I could make my latest game, Bricks, compatible with her iPod and/or DSi. I said to her I'll see what I could do.
I added a simple onmousemove event to the game. Although that accomplished a few minor things (paddle is now movable via mouse and stylus), it neither worked on iPod (duh) and the DSi.
Using HullBreache's wonderful library of SDK samples, I studied clientX and other mouse tactics.
No luck.
While reading in one of my books, I stumbled upon a new group of events called touch events. I decided to try my hand (and fingers) in this newfound wonder.
I started by adding "ontouchmove" event to a canvas, triggering a test alert. It worked! The alert popped up not when touched the canvas, but slid my finger across.
But more frustration came upon me when I tried to add clientX. Turns out ontouchmove is a bit more demanding than onmousemove. While onmousemove deals with one cursor, ontouchmove has many possible combinations.
So I did more research. And found a whole new group of DOM controls that help translate the different actions.
Adding an "if" statement to check if only one finger is being used, I open an array of controls, focusing the action to that only finger.
Once all that is filtered out, then I can use clientX (actually, I used screenX, since it works better on iPod) to determine the location of the paddle.
STILL NO >.<
Very very picky stuff. I tried what seemed like hundreds of combinations, until finally, right on the verge of giving up, I found it. I was able to move the paddle by finger on the iPod touch!
All I had next to worry about was the actual screen scrolling. It still wanted to vertically scroll on me, thus canceling the whole process.
Tried return; false with no success. So back to the book.
I found the secret weapon that completely locks the page in place as long as one finger remains on the screen.
And as an added bonus, tapping three fingers pauses the game.
Very proud and excited, I showed HB, who was also thrilled. He asked if he can use it for Paint. Sure, why not? After all, the main inspiration came from his own work.
So that's why you can now paint with the iPod touch/iPhone.