Re: GeekGameBoard (was: Re: Touch-and-drag architecture question)
Re: GeekGameBoard (was: Re: Touch-and-drag architecture question)
- Subject: Re: GeekGameBoard (was: Re: Touch-and-drag architecture question)
- From: Jens Alfke <email@hidden>
- Date: Mon, 15 Feb 2010 09:36:34 -0800
On Feb 15, 2010, at 8:49 AM, Dave DeLong wrote:
> As far as GGB goes, how well does it handle custom boards? For example, let's say I wanted to recreate this board: http://gallery.me.com/davedelong#100084/Board&bgcolor=black (dots are valid positions, and lines indicate valid moves between positions).
> Presumably I'd be creating a custom "Grid" subclass and building the board layout in there. My board is based on a square grid, but I'm not sure how I'd only make some of the grid positions valid locations, nor how I'd draw the lines in between them. What would I need to do to recreate this board?
You can create a 7x7 RectGrid and then call -removeCellAtRow:column: to remove the cells that don't appear in that board. You'd also want to set the borderWidth to 0 in the remaining cells so they don't draw their square outlines.
Alternatively, you could just start with an empty board and add a BitHolder object for every valid position.
Drawing the background lines is up to you. You could create a fancy image of the board and add it as a PNG file, or you could make a CALayer for the background that has a custom drawing callback.
—Jens_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden