Wednesday, March 4, 2009

iPhone Journal 0xB

As planned, I worked on movement animation today. I gained a better understanding of how Quartz 2D works and that at no point does the programmer actually refresh the screen; it is refreshed after the function that must contain all of an applications drawing commands. This made it incredibly difficult to create a framework for piece movement, but I at last succeeded by creating a special function that fires 24 times/second. I managed to make the drawing code incredibly efficient such that it only redraws the graphics for the region directly affected by moving a piece. I also determined how to detect where the user presses on the screen and wrote pseudocode for the function that will handle this information. The video clip below is a demonstration of me clicking a test button that is tied to smoothly animating the motion of a piece on the board. While it may not seem very significant, the true changes are visible only in the code; the same animation function that performs the movement in the video can be applied to any piece movement on the screen, even jumps.


I am very glad that I began working on this project earlier than I had intended because of all of the unforeseen problems I have encountered already and will encounter in the future. The experience of producing the application has also taught me many aspects of the Objective-C language that are not even mentioned in my textbook. Programming forums are a great reference for what commands can be used to achieve specific effects. I am getting used to using Apple's technical API documentation as well.
Tomorrow, I plan to implement most of the selection and movement code that is inherent in every move of Cingo. I shall also expand on the foundational code I wrote today to start building some of the logic functions.

No comments:

Post a Comment