|
Title: GUI Level Editor Questions Post by: BlueSweatshirt on December 01, 2011, 10:59:00 PM As an exercise and also to use the finished product on one of my projects, I wanna make a GUI level editor. I want to make it with Cocoa and blah blah Mac tools, but I figure the concepts may be universal.
What I'm wondering is if there's any 'general' approach to making the level room view? I was thinking about adding a bunch of imageview subviews for the tiles of a room... And then I'd have to iterate through the list of subviews in the level room view and record their data on file save? But I really just feel like there's a better way. I'm not sure. That's why I'm here asking. :handthumbsupL: Disclaimer: I'm a total GUI noob and am still learning. Title: Re: GUI Level Editor Questions Post by: Average Software on December 02, 2011, 05:54:21 AM What you want to do is to create a subclass of NSView and then paint your tiles on it. Depending on the size and complexity of the image, you'll either want to look at NSImage or the lower level CGImage stuff.
For larger setups in which you need to support a scrolling view, I find that the CGImage stuff is much more efficient and gives you better control. If you don't know how dirty rectangle works, look it up, because pretty much all GUI systems use it and if you want efficient drawing you need to plan ahead for it. The test builds for my game (http://www.averagesoftware.org/files/franchise.dmg) have a native level editor and the complete source code for the editor is included, which you might find useful. Title: Re: GUI Level Editor Questions Post by: BlueSweatshirt on December 02, 2011, 04:09:20 PM Fantastic! :beer:
That was very helpful, thanks. Title: Re: GUI Level Editor Questions Post by: mcc on December 02, 2011, 07:41:40 PM I might suggest using an NSOpenGLView and using actual OpenGL (or SFML or something) calls to draw your tiles.
That way, you can reuse your code for your tile draw-er from the level editor, in an actual game later. This not only saves you time, it means you will not have to be scratching your head once you write the game and going "why doesn't this look exactly the same". This is bad advice if you're not already familiar with OpenGL etc because OpenGL could be time consuming enough to learn it could derail the project. This also isn't useful advice if you intend to dump the tiles into Flash or something later. Title: Re: GUI Level Editor Questions Post by: BlueSweatshirt on December 04, 2011, 01:15:58 AM I started learning OpenGL at one point, but I ended up abandoning the cause. :(
I think it'll be in my interests to start learning it before too long, though.(getting interested in 3D games) Anywho. Are there any shorter/more to the point/more approachable/less SNOOZEFESTY resources for learning Mac/iOS programming than Apple's written guides? I'm not going to say they're bad, they're fantasticaly informative. But they beat around the bush a lot and I feel like I'm going nowhere fast, when the reality is I'd like to start getting my hands dirty and start trying things as soon as possible. It's also entirely possible that I'm just not looking at the right documents. |