• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using an NSMatrix subclass for a board game view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using an NSMatrix subclass for a board game view


  • Subject: Re: Using an NSMatrix subclass for a board game view
  • From: Stig Brautaset <email@hidden>
  • Date: Fri, 12 Oct 2007 20:27:20 +0100


On 12 Oct 2007, at 19:12, Fritz Anderson wrote:
On 12 Oct 2007, at 11:31 AM, Brautaset Stig wrote:
I'm writing a simple Reversi game, and I'm currently struggling a bit trying to create a simple animation of the pieces being flipped when a player (or the AI) makes a move. I'm using a subclass of NSMatrix for my main view, and trying to make it call its own display routine again.

[snip helpful response]

In the long run, you might want to consider your own board view. You are already fighting NSMatrix by providing your own mouseDown: method (why can't Desdemona receive an action from the NSMatrix and do the transition itself?).

I'd love to do that! I couldn't figure out how though. Using NSMatrix seems to be somewhat under-documented.


Is there a way to configure the NSMatrix to send a 'somebody clicked me!' event to its delegate?

Also, you're keeping the state of the game in your NSMatrix subclass.

It's not ideal, but it's only a cache of the state used for display purposes. The _actual_ state is somewhere else, in an instance of a SBReversiState (hidden away in a framework[0] in vendor/AlphaBeta).


having to rework the other. Use the class Desdemona as a controller object, to translate click actions into state changes, and to propagate state changes to the display.

This is what I'm aiming at, yes. The alphaBeta[1] instance variable in Desdemona contains the actual model.


[0] your book came in real handy learning how to create those ;)

Stig

--
http://code.brautaset.org
http://blog.brautaset.org


_______________________________________________

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


  • Follow-Ups:
    • Re: Using an NSMatrix subclass for a board game view
      • From: Stig Brautaset <email@hidden>
References: 
 >Using an NSMatrix subclass for a board game view (From: Brautaset Stig <email@hidden>)
 >Re: Using an NSMatrix subclass for a board game view (From: Fritz Anderson <email@hidden>)

  • Prev by Date: Re: Reading a binary file format?
  • Next by Date: Re: Reading a binary file format?
  • Previous by thread: Re: Using an NSMatrix subclass for a board game view
  • Next by thread: Re: Using an NSMatrix subclass for a board game view
  • Index(es):
    • Date
    • Thread