I did a talk yesterday at the Raleigh Code Camp. It went well I think. If anyone was at the talk and would like to give me feedback, feel free. The only way I’ll get better is if I know how effective / non effective the talk was.
It is always interesting trying to give a talk to an audience with people who have no clue what XNA is as well as those who have been fooling with it for a year or more. Ultimately, there are parts where both parties are bored – but hopefully not at the same time!
Anyway, while the talk was more about best practices for XBLIG and what you need to do to submit games to ultimately make money using XNA, we did spend the last 10-15 minutes of the session looking at a scribble app I made for the Zune HD on Friday night before the session.
Rob Zelt mentioned on twitter that I may have very well been the first person to do an XNA talk with a demo for the Zune HD at a Code Camp. Seeing how the Zune HD was just released this past week and typically Code Camps are held on Saturdays and I had the second session of the day at 9:40 EST I think he may be right. For some reason that makes me smile. A geeky gold star for me.
OK, now to the actual project. You can download the project and look at the comments to see what it is doing. I also did a brief video on it Friday night after I got it working.
At a high level, the code is simply looking at the touch panel collection to see all of the points / vector2 that were moved. It grabs the starting and ending point for this move and adds it to a list. We then draw a line from the starting point to the ending point and do that for each line segment in our line list. To erase it, we just shake the device. Really, we are just checking the difference of the acceleration on the X or Y axis to see if it has moved a certain amount in a frame. This way if someone just moves it slowly or turns it the screen won’t erase, but if it is a fast enough motion (easily produced by shaking) then we clear the line list so there is nothing to draw. The demo code also collects the rotation of the device from the accelerometer as well as the acceleration, but doesn’t actually use the rotation values.
Hopefully this will give you an idea of what is needed, but you should definitely check out the documentation from XNA Game Studio. In order to run this, you will need a Zune HD as well as the latest XNA Framework which comes in XNA Game Studio 3.1 Zune Extensions.
Download Zune HD Scribble Test
Happy Coding!
-Chad
39e568e2-dadb-4fff-9dd9-caf4d39f31af|0|.0|96d5b379-7e1d-4dac-a6ba-1e50db561b04
Tags :