• 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: problem with NSMatrix
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with NSMatrix


  • Subject: Re: problem with NSMatrix
  • From: joie <email@hidden>
  • Date: Sat, 6 Apr 2002 13:13:53 -0600

On Saturday, April 6, 2002, at 12:03 , Erik M. Buck wrote:

----- Original Message -----
From: "joie" <email@hidden>
well, setting a custom cell class in IB wouldn't help, as at my
program's start, since there are a variable number of cells, i must set
it programatically- i only threw in the setCellClass: to illustrate that
I was using a custom NSButtonCell subclass...
I can't remove all the cells and respawn them, either, as this is a
level editor for a tile-based RPG, and to lose all one's work just
because one mis-sized the map would be quite frustrating.

You should not be storing your game's state in cells. Cells are part of a
view in the model-view-controller paradigm. You need a model that stores
game information. The fact that you use cells or a custom view or text to a
terminal should not matter to the model. Besides, if you are creating the
matrix programmatically then there is no problem. Set the cell class BEFORE
you populate the matrix with cells.


I know I may be violating M-V-C, but in the case of the editor, the 'model object' of the area i'm editing is a simple c struct, and I'm even just using C functions to write it to disk... The game proper is written in C using OpenGL and GLUT... at any rate, the image and image tag associated with a tile, in the editor, is certainly part of the tile's state- and it's not all that much different than using setImage: on a button, it's just an extra tag so that I can identify the image in the C 'area' struct the tiles that I need to use. Again; the model I use is a struct that's only generated when the map is saved.
I am setting the cell class before I populate, but I'm given the wrong cells anyway- but lance bland told me about a class method setCellClass: of NSControl that might fix it...

See http://www.stepwise.com/Articles/Technical/NSCell.html which
coincidentally describes using cells in a game's map editor.

As for the article, it's well-written and sensible and I believe I've even looked at it before. ^_^ I'll download and look at the class, thank you very much for pointing it out.

-joie
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: problem with NSMatrix (From: "Erik M. Buck" <email@hidden>)

  • Prev by Date: Screensavers and Text Flicker
  • Next by Date: Administrators Needed: Learning Cocoa Techstra Book
  • Previous by thread: Re: problem with NSMatrix
  • Next by thread: Re: problem with NSMatrix
  • Index(es):
    • Date
    • Thread