Fixed: Bits with odd heights or widths could be blurry when placed on a Grid (thanks to David Hoyos for the fix!)
1 {\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf270
2 {\fonttbl\f0\fnil\fcharset0 Verdana;}
3 {\colortbl;\red255\green255\blue255;}
4 \margl1440\margr1440\vieww13900\viewh17120\viewkind0
5 \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
7 \f0\b\fs38 \cf0 GeekGameBoard
14 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.\
16 Some of the generally-useful Core Animation techniques illustrated are:\
18 \'95 Dragging CALayers with the mouse\
19 \'95 Loading images from files and setting them as layer contents\
20 \'95 3D "card-flip" animations\
27 I wrote GeekGameBoard in 2007 while at Apple, which published it as sample code. Apple's sample code license allows unrestricted use of the source code, requiring only that you keep their copyright notice in an
31 I am no longer employed by Apple. To encourage further development of this framework, in March 2008 I created this open source project (under a BSD license) based on a slightly-evolved version of the published sample code.\
33 1.0: Original Apple sample code release (12/19/2007)\
34 2.0: First open source release. (Major version number bumped to avoid conflict with any future Apple revisions.) No longer requires garbage collection. Fixed some memory leaks of CG objects. Fixed a bug when advancing to the 8th row in the Checkers game. (3/7/2008)\
37 \b\fs28 Project Description\
46 \b0 is a moveable object in a game, either a
53 \b0 is a container for Bits; they can be dragged into and/or out of it. Typical BitHolders are
55 \b0 s (the squares/hexes in a board),
61 \b0 (supplies of new pieces.)\
64 \b0 is a regular arrangement of
66 \b0 s; rectangular and hex grids are implemented.\
69 \b0 is the NSView whose layer hosts all of the above. It also tracks mouse events so the user can drag Bits.\
72 \b0 represents the rules of a particular game. It sets up the pieces/cards/grids that make up the game, decides which moves are legal, keeps track of whose turn it is, and decides when someone's won.\
75 \b0 is a passive object that represents one of the players in a Game.\
81 (Underlined classes are from external frameworks; italic classes are abstract.)\
119 TicTacToeGame (etc...)\
123 \fs20 * BitHolder is actually both a protocol, and a class that implements the protocol. I've combined them here, for simplicity.\
128 \b\fs28 Related Information\
131 \'95 {\field{\*\fldinst{HYPERLINK "http://developer.apple.com/samplecode/GeekGameBoard/"}}{\fldrslt Apple's original GeekGameBoard sample code}}\
132 \'95 {\field{\*\fldinst{HYPERLINK "http://developer.apple.com/documentation/Cocoa/Conceptual/CoreAnimation_guide/index.html"}}{\fldrslt
133 \i Core Animation Programming Guide}}\
135 \i \'95 {\field{\*\fldinst{HYPERLINK "http://developer.apple.com/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_images/chapter_12_section_4.html"}}{\fldrslt Quartz 2D Programming Guide: Creating Images}}\
136 \'95 {\field{\*\fldinst{HYPERLINK "http://developer.apple.com/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_patterns/chapter_7_section_1.html"}}{\fldrslt Quartz 2D Programming Guide: Patterns}}\
137 \'95 {\field{\*\fldinst{HYPERLINK "http://developer.apple.com/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_paths/chapter_4_section_1.html"}}{\fldrslt Quartz 2D Programming Guide: Paths}}