On 02/03/2009, at 12:22 PM, Oliver Charles wrote:

I've started learning Objective-C and Cocoa, and while I'm fairly
experienced with programming, GUI programming is quite new to me.

I'm working on a small game engine, and as such, I want to create a
level editor for the game. I love the old style Doom level editors, so
that's what I'm going for [1]. Notice in that screenshot the amount
the user can interact with - moving vertices on the grid, creating
lines between vertices, adding/removing objects, etc.

At the moment, I have a main MapView control, which creates vertices
in an NSArrayController. I have 2 ways of viewing these vertices - one
is to handle rendering them directly in the MapView, and another
approach creates a new VertexView for each vertex, and adds it as a
subview of the MapView. From what I've read online, this is not going
to scale beyond maybe 50 vertices, so I don't think this is an
approach. However, handling *everything* in the MapView itself feels
like it drastically reduces the cohesion of the control.

How do people create controls like this? I suppose similar controls
(to a slightly lesser extent, may be helpful if you don't understand
the screenshot below) would be things like OmniGraffle and the Core
Data editor in Xcode.


This could be a good candidate for DrawKit, my framework for vector drawing. You'd need to take a look and see how closely it fits your needs but it handles all the interactive creation of objects for you. It's designed to be scalable and doesn't create a subview per object (which is crazy talk, BTW :). It might seem like overkill but you are not obliged to use everything, and the whole framework adds only about 3.5MB to an app.

Setting up a complete view with interactive drawing tools takes a few minutes' work in IB, though be prepared to write a fair bit of export code to convert the "drawing" into your map data. Of course it has a learning curve on top of Cocoa itself, but doesn't need a lot of set- up to get working.

http://apptree.net/drawkit.htm

--Graham


_______________________________________________

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

Reply via email to