GeekGameBoard
Santa has an early Xmas present for all you good Leopard programmers: GeekGameBoard, a new piece of sample code by the anonymous engineer elves at Apple.
[Update: GeekGameBoard is now an open-source project hosted at bitbucket.org.]
GeekGameBoard is an example of using Core Animation to present the user interface of a board or card game. It implements a small framework for implementing such games, with domain-specific classes like “Grid” and “Piece”, and examples of several game definitions built on top of the framework.
Some of the generally-useful Core Animation techniques illustrated are:
• Hit testing
• Dragging CALayers with the mouse
• Loading images from files and setting them as layer contents
• 3D “card-flip” animations
Framework classes include Bit, Piece, PlayingCard, HexGrid and more. It comes with sample games from Klondike solitaire to Checkers and even Tic-Tac-Toe. It’s all ready for you to add AI, network play, new game definitions…


![]()
PS: Icon websites like IconFactory, InterfaceLift and DeviantArt are great places to get artwork for game pieces. (My personal favorite game pieces are Ginko’s Icons, shown on the right.) Just be aware that most icons, even if freeware, require you to get the copyright holder’s permission for anything other than personal use.
December 20th, 2007 at 2:37 PM
I love those anonymous elves. Can’t wait to look at some of the Core Animation hit testing and the like.
December 20th, 2007 at 4:23 PM
This is pretty neat. Thanks for linking to it.
December 21st, 2007 at 1:55 PM
Cool, I’ll have to look into this garbage-collection business though - so used to doing refcounting !
December 21st, 2007 at 3:31 PM
@aegidian — It’s just like doing refcounting, except that every time you were going to type “[foo retain]” or “[foo release]”, you eat a piece of candy instead. It’s delicious, if somewhat fattening.
July 6th, 2009 at 10:46 AM
This is a great learning tool for those of us just getting started. I have seen you use some things that I am not really familiar with. Would it be appropriate to use this forum to ask some basic Objective C questions related specifically to your code?
Many thanks again,
HLC