There is probably a way to do this, but you are probably going to be
side stepping SDL to achieve this.
In general (outside of SDL), what you describe seems possible. The
Calculator.app behaves kind of like this. You can’t resize it, but the
green button transforms the calculator between Basic, Scientific, and
Programmer modes.
I sadly don’t have time to actually try implementing any of this, but
I suspect you might start defining SDL_RESIZABLE and then try turning
things off.
A quick search through the NSWindow documentation shows this method:
- (void)setShowsResizeIndicator:(BOOL)showResizeIndicator
Specifies whether the receiver’s resize indicator is visible
I’m hoping this will just turn off the resize indicator in the
bottom-right corner. But if not, or if you need to start with
SDL_RESIZABLE off, it looks like there are masks for this stuff.
NSWindowZoomButton (part of NSWindowButton enum) and
NSResizableWindowMask turn up. You’ll need to track down the API calls
that work with this.
Finally, to control what happens on ‘Zoom’, I don’t think SDL offers
anything here either (maybe I’m wrong). So you’ll need to define what
to do. It looks like NSWindow responds to the following delegate on
zoom:
- (NSRect)windowWillUseStandardFrame:(NSWindow *)sender
defaultFrame:(NSRect)defaultFrame
Invoked by the zoom: method while determining a frame the sender may
be zoomed to.
So you’ll want to define this delegate and prepare for your fullscreen
switch. However, it looks like this delegate is actually just part 1
of a 6 part chain of events. And it looks like this method was
designed to return a new size for your window, not necessarily switch
to fullscreen.
So if you can’t switch to fullscreen directly from here, then you
might need to set a NSNotification or push a custom event into the
SDL_Event loop so you know to switch to fullscreen later.
I suspect a convenient place to drop all this code is in the SDLMain.m file.
If you get all this working, I would certainly like to see your code.
Maybe we can add it to the list of Xcode project templates we provide
(some of which demonstrate tighter Cocoa integration like this).
Good luck,
Eric