GeekGameBoard (was: Re: Touch-and-drag architecture question)
GeekGameBoard (was: Re: Touch-and-drag architecture question)
- Subject: GeekGameBoard (was: Re: Touch-and-drag architecture question)
- From: Dave DeLong <email@hidden>
- Date: Mon, 15 Feb 2010 09:49:57 -0700
Thanks, Jens! I'd never heard of this before, and it looks like it'll fit the bill nicely. However, I'm a total noob when it comes to CoreAnimation, so it may be a while before I grok what's going on underneath.
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?
Thanks!
Dave
On Feb 14, 2010, at 3:18 PM, Jens Alfke wrote:
> CoreAnimation is the best way to go for board games IMO. Lighter weight than views, and it does the interpolation for you.
>
> I wrote a framework for board games using CA:
> http://bitbucket.org/snej/geekgameboard
>
> --Jens {via iPhone}
>
>
> On Feb 14, 2010, at 1:38 PM, Dave DeLong <email@hidden> wrote:
>
>> Hi everyone,
>>
>> I've an iPhone app that I'm working on (it's a simple game), where I've got the game board on the screen, and then a row of pieces above and below the board (representing the pieces controlled/captured by each player). I'd like to be able to drag pieces from these rows onto the board. My question is this:
>>
>> How should I set up the view hierarchy to do the drag and drop? As I see it, there are three main ways:
>>
>> 1. Use different views for the board and the two rows. This is good for encapsulation, but bad for cross-view dragging.
>> 2. Use a single view for the board and the two rows. This is bad for encapsulation, but makes dragging much easier.
>> 3. Use different views for the board and the two rows, but have an invisible view on top of everything that captures all the events and passes them on accordingly. I'm not sure how this would work out.
>>
>> Perhaps another important question is: how should pieces be rendered? I've been drawing them with CoreGraphics (hence the difficulty of dragging them between views), but I could also make each piece its own UIView (which might complicate dragging in other ways).
>>
>> What do you suggest?
>>
>> Thanks!
>>
>> Dave DeLong
>> _______________________________________________
>>
>> 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
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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