[SDL] Cocoa & SDL

E. Wing ewmailing at gmail.com
Sun Nov 19 23:35:24 PST 2006


Have you looked at the Xcode template project called "SDL Custom Cocoa
Application"? I think it demonstrates a lot of what you are talking
about.

-Eric


> From: Thomas Harte <thomas.harte at gmail.com>

> I want my SDL application to have a full Cocoa UI. I've read various old
> threads
> on Cocoa & SDL and so far am using setenv to set a non-zero value for
> SDL_ENABLEAPPEVENTS and have added a sendEvent handler to my implementation
> of
> SDLApplication that checks if incoming events are keyboard related, and if
> so
> throws them away if command is not pressed. With a bit of nib magic from
> Interface Builder that gives me a fully interactive Cocoa UI with the one
> obvious defect ? it isn't responding to keypresses that don't have command
> pressed. As a result things like "File->Save" are almost impossible to use.
> Of
> course if I don't filter keyboard input like this then every time the user
> presses a key I get an error beep as Cocoa thinks the user has pressed a key
> that doesn't do anything.
>
> My slightly hacky solution so far is to keep an internal flag of any time I
> launch a dialogue that would want proper keyboard input and not to filter it
> out until that dialogue has finished. I'm wondering if there is a better
> solution that can be implemented while still separating my Cocoa code from
> the
> main body of my ordinary cross-platform code. Perhaps some sort of invisible
> window that accepts ordinary keypresses while my app is active but does
> nothing with them?
>
> I'd be curious to hear what others have done to get around this problem.
>




More information about the SDL mailing list