1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/Read Me.rtf Fri Jul 18 13:26:59 2008 -0700
1.3 @@ -0,0 +1,139 @@
1.4 +{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf270
1.5 +{\fonttbl\f0\fnil\fcharset0 Verdana;}
1.6 +{\colortbl;\red255\green255\blue255;}
1.7 +\margl1440\margr1440\vieww13900\viewh17120\viewkind0
1.8 +\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
1.9 +
1.10 +\f0\b\fs38 \cf0 GeekGameBoard
1.11 +\b0\fs22 \
1.12 +\
1.13 +
1.14 +\b by Jens Alfke
1.15 +\b0 \
1.16 +\
1.17 +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.\
1.18 +\
1.19 +Some of the generally-useful Core Animation techniques illustrated are:\
1.20 +\'95 Hit testing\
1.21 +\'95 Dragging CALayers with the mouse\
1.22 +\'95 Loading images from files and setting them as layer contents\
1.23 +\'95 3D "card-flip" animations\
1.24 +\
1.25 +
1.26 +\b\fs28 History
1.27 +\b0 \
1.28 +
1.29 +\fs22 \
1.30 +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
1.31 +\i unmodified
1.32 +\i0 distribution.\
1.33 +\
1.34 +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.\
1.35 +\
1.36 +1.0: Original Apple sample code release (12/19/2007)\
1.37 +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)\
1.38 +\
1.39 +
1.40 +\b\fs28 Project Description\
1.41 +
1.42 +\b0\fs22 \
1.43 +
1.44 +\b Important Classes
1.45 +\b0 \
1.46 +\
1.47 +A
1.48 +\b Bit
1.49 +\b0 is a moveable object in a game, either a
1.50 +\b Card
1.51 +\b0 or a
1.52 +\b Piece
1.53 +\b0 .\
1.54 +A
1.55 +\b BitHolder
1.56 +\b0 is a container for Bits; they can be dragged into and/or out of it. Typical BitHolders are
1.57 +\b GridCell
1.58 +\b0 s (the squares/hexes in a board),
1.59 +\b Deck
1.60 +\b0 s or
1.61 +\b Stack
1.62 +\b0 s of cards, and
1.63 +\b Dispensers
1.64 +\b0 (supplies of new pieces.)\
1.65 +A
1.66 +\b Grid
1.67 +\b0 is a regular arrangement of
1.68 +\b GridCell
1.69 +\b0 s; rectangular and hex grids are implemented.\
1.70 +
1.71 +\b BoardView
1.72 +\b0 is the NSView whose layer hosts all of the above. It also tracks mouse events so the user can drag Bits.\
1.73 +
1.74 +\b Game
1.75 +\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.\
1.76 +
1.77 +\b Player
1.78 +\b0 is a passive object that represents one of the players in a Game.\
1.79 +\
1.80 +
1.81 +\b Class Hierarchy
1.82 +\b0 \
1.83 +\
1.84 +(Underlined classes are from external frameworks; italic classes are abstract.)\
1.85 +\
1.86 +\ul CALayer\ulnone \
1.87 +
1.88 +\i Bit
1.89 +\i0 \
1.90 + Card\
1.91 + PlayingCard\
1.92 + DraggedStack\
1.93 + Piece\
1.94 + DiscPiece\
1.95 +
1.96 +\i BitHolder*
1.97 +\i0 \
1.98 +
1.99 +\i GridCell
1.100 +\i0 \
1.101 + Hex\
1.102 + Square\
1.103 + GoSquare\
1.104 + Deck\
1.105 + Dispenser\
1.106 + Stack\
1.107 +
1.108 +\i Grid
1.109 +\i0 \
1.110 + HexGrid\
1.111 + RectGrid\
1.112 +\
1.113 +\ul NSView\ulnone \
1.114 + BoardView\
1.115 +\
1.116 +
1.117 +\i \ul NSObject
1.118 +\i0 \ulnone \
1.119 +
1.120 +\i Game
1.121 +\i0 \
1.122 + TicTacToeGame (etc...)\
1.123 + Player\
1.124 +\
1.125 +
1.126 +\fs20 * BitHolder is actually both a protocol, and a class that implements the protocol. I've combined them here, for simplicity.\
1.127 +
1.128 +\fs22 \
1.129 +\
1.130 +
1.131 +\b\fs28 Related Information\
1.132 +
1.133 +\b0\fs22 \
1.134 +\'95 {\field{\*\fldinst{HYPERLINK "http://developer.apple.com/samplecode/GeekGameBoard/"}}{\fldrslt Apple's original GeekGameBoard sample code}}\
1.135 +\'95 {\field{\*\fldinst{HYPERLINK "http://developer.apple.com/documentation/Cocoa/Conceptual/CoreAnimation_guide/index.html"}}{\fldrslt
1.136 +\i Core Animation Programming Guide}}\
1.137 +
1.138 +\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}}\
1.139 +\'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}}\
1.140 +\'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}}
1.141 +\i0 \
1.142 +}
1.143 \ No newline at end of file