SDL display window and cocoa control windows..

Post: #1
Hello all, I've been lurking for a while but found I need to post..

I am working on the toolset for a game engine, SDL based, cross-platform.

However: I am an experienced Windows developer who has only recently switched to OSX (a few months ago) and so some OSX/XCode things still have me puzzled.

The one that's plaguing me now, is how do I open an SDL window AND some cocoa windows? The reason is that I need my gui widgets to render using the same objects they will render with in the game engine (for code maintainability mostly) so I want to have an SDL interface design window open, and then the Cocoa tool windows open (probably in the other monitor.).

I know this SHOULD be possible, and I seem to recall reading an article about how to do it, but my google-fu is failing me. If someone can go over the basic steps? Do I start with a cocoa app template and then open an SDL window? How do I get messages (clicks, etc) from the SDL window?

Barring that working at all, is there a way I can get SDL to render into an offscreen surface and then just do some blit to a cocoa customview?

Quote this message in a reply
Posts: 233
Joined: 2003.05
Post: #2
You know what I would do? I'd make sure your objects and widgets use OpenGL calls. Smile I have no idea if you are using OpenGL so this could be a major problem. Anyway, that would make your objects work in any context basically. Then you could whip up a Cocoa app for editing, and an SDL game both using those same objects with the openGL calls. Wink

Probably, though, you aren't using OpenGL. In that case, it will be more tricky. Of course you could make your own widgets to use in an SDL based editor... just use a hotkey to let an overlay come up (rather than use a second monitor for the tools.)

Possibly the worst option (with the most desirable results) is to hack into SDLmain and get that to cooperate with your own nib files and SDL. That COULD be a nightmare, but I haven't even gotten past simply adding an application menu with the quit command. Rasp So, best of luck with that option and please write a step by step if you get it to work for you. Wink

You are running into the major trade off for using a cross platform API like SDL. Not getting to take easy advantage of a platform's given unique and powerful features. Sad

"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Copying from OpenGL window to other window Ingemar 7 7,576 Nov 4, 2006 03:50 AM
Last Post: OneSadCookie
  tutorials for setting up a window in opengl cocoa vbuser1338 6 6,632 Mar 14, 2005 02:16 PM
Last Post: maaaaark
  Multiple OpenGL Windows in Cocoa Adger Stokvisch 13 11,606 Dec 13, 2004 05:40 AM
Last Post: Adger Stokvisch