Monday, March 2, 2009

iPhone Journal 0xA

After a short break on the weekend, I was able to continue working on my iPhone project with a fresh mindset. As planned, I worked on one of the graphics chapters in my textbook. To my delight, Quartz 2D, Apple's simplified graphics system for drawing on the iPhone seems capable of handling the drawing required for a board game such as my final project, Cingo. I went through the code of setting up the drawing canvas and progressed towards drawing lines of various colors, as shown below, yet I believed that I could better manage my time by skipping the repetitive sections of the chapter and looking in detail at the ones I will be using in my application.
At one point in coding the example project, I was given a ridiculous error by the compiler, something along the lines of "Unable to read symbols for "/System/Library/Frameworks/UIKit.framework/UIKit" (file not found)." This is completely meaningless as the UIKit framework was certainly included in my project. After over an hour of searching online, I was able to determine that this error results when the interface is set up incorrectly, but rebuilding the interface did not alleviate the problem. Suddenly, I glanced at a seemingly harmless warning message that I got when compiling. The entire problem was caused by forgetting an @ symbol before the quotes of a string constant.


I became frustrated with the sample application and so began to experiment with the pre-made example to see what I could do with images in Quartz 2D. Some simple tests confirmed that the API supports transparency, but that a static image may not be placed below the drawing view (canvas).
After I had sufficient knowledge of Quartz 2D for my current purpose, I began to lay out in my mind the features and structure that the Cingo application will have. Thereafter, I began to code the board drawing functionality and to design the board and pieces. A screenshot of the applications I used in this process is shown below:
On the left is the current simulation of the interface after compilation, Xcode is running in the background, and Interface Builder consists of the black window and the lower right window underneath that containing the board. I used Blender 3D to quickly render the pieces and board, and then modified these images slightly using GIMP and Preview to make them fit on the iPhone screen in a presentable format.


Tomorrow, I intend to start studying/implementing several of the following topics:
Data Persistence (save on exit), moving a piece from square to square smoothly, using a series of sprites for animation, detecting finger taps/slides, coding application logic, and creating a useable interface. I cannot meet with Mr. Collias or any of the people in his team on Wednesday, so I plan to do so only on Friday; doing so tomorrow or on Thursday is pointless. Next week, I plan to have learned most of the basic concepts I will need and will then finalize my project along with a presentation and a final essay combining my experiences.