Hello All -- I'm trying to subclass NSMatrix to lay cells out in a hexagonal tiling instead of a proper grid (as a foundation for a game with a hexagonally tiled board). It seemed an appropriate base class, as I still index cell locations with rows and columns. Cells are constrained to be of a particular shape, and every other column is offset half a cell height. I hope that's clear, but see [1] for more info on what I mean.
[1] http://www.gamedev.net/reference/articles/article1800.asp Anyway, I thought I might be able to get away with overriding as little as: - drawCellAtRow:column: - cellFrameAtRow:column: - getRow:column:forPoint: - setCellSize: - setIntercellSpacing: and then for drawing giving the target cell the outer bounding rect of a regular hexagon with that width (which overlaps with the bounding rects of the adjacent columns) if it responds YES to a selector "isHexShaped" or the largest rect possible inside the hexagon if it doesn't respond in that fashion. It doesn't seem to work though. Problems are: - "drawCellAtRow:column:" doesn't seem to ever get called unless I call it myself while overriding "drawRect:" - "cellFrameAtRow:column:" only gets called when you click on the view - "getRow:column:forPoint:" isn't getting called either by the super's "mouseDown:" to identify which cell was clicked on I've poured over docs, googled, and experimented. No joy yet. Is there something that one can hook into to reposition the cells such that the superclass's "drawRect:" and picking code do something sensible, or would all that have to be re-implemented? Would cocoa-wisdom greater than I've acquired thusfar suggest a different base class that might meet my needs better than NSMatrix? Note, I'm somewhat new to Cocoa (though I've read fully through half a dozen apple cocoa guides and worked through 90% of the 3rd ed Hillegass book), but not to programming. Thanks a lot! Matt Anderson _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com