Menus

Member
Posts: 233
Joined: 2003.05
Post: #31
Huh No. Please keep it a secret. Rolleyes
GIMMEE GIMMEE GIMMEE! Cry
Theatrics aside. Please do not ask if anyone wants simple solutions to universal problems. Please, post them! Thank you for sharing! Love

"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote this message in a reply
Moderator
Posts: 770
Joined: 2003.04
Post: #32
Count me in Love
Quote this message in a reply
Moderator
Posts: 608
Joined: 2002.04
Post: #33
aaronsullivan Wrote:Huh No. Please keep it a secret. Rolleyes
GIMMEE GIMMEE GIMMEE! Cry
Theatrics aside. Please do not ask if anyone wants simple solutions to universal problems. Please, post them! Thank you for sharing! Love
On the other hand maybe I'll just keep it to myself... Rasp

In SDL_QuartzWindow.m, find -miniaturize. Replace it with this:

Code:
- (void)miniaturize:(id)sender
{
    if (SDL_VideoSurface->flags & SDL_OPENGL) {
    
        NSSize size = [[self contentView] bounds].size;
        
        void *buffer = malloc(size.width * size.height * 4);
        if(buffer == NULL)
        {
                return;
        }
        
        glReadPixels(0,
                                    0,
                                    size.width,
                                    size.height,
                                    GL_RGBA,
                                    GL_UNSIGNED_BYTE,
                                    buffer);
        
        [[self contentView] lockFocus];
        
        NSDrawBitmap([[self contentView] bounds],
                                    size.width,
                                    size.height,
                                    8,
                                    4,
                                    32,
                                    size.width * 4,
                                    NO,
                                    NO,
                                    NSDeviceRGBColorSpace,
                                    (unsigned char const **)&buffer);
        
        [[self contentView] unlockFocus];
        
        free(buffer);
        buffer = NULL;
    }
    else {
        
        /* make the alpha channel opaque so anim won't have holes in it */
        QZ_SetPortAlphaOpaque ();
    }
    
    /* window is hidden now */
    SDL_PrivateAppActive (0, SDL_APPACTIVE);
    
    [ super miniaturize:sender ];
}

The actual code came from Keith Bauer. It hasn't been tested, but it works for me. Smile With this and the menu fix, SDL apps actually seem right.

Edit: If it doesn't work for you, Alex (ThemsAllTook) suggested adding [self flushWindow] after you unlock the focus.
Quote this message in a reply
Moderator
Posts: 608
Joined: 2002.04
Post: #34
On a slightly related note, does anyone have any idea why ToggleFullScreen doesn't work?
Quote this message in a reply
MarkJ
Unregistered
 
Post: #35
I'm in the middle of menu control with SDL as well. Anyone have anything new on this? When will we see better OS X UI support in SDL-- and what workarounds have you found to get a basic mac UI feel?
Quote this message in a reply
Member
Posts: 233
Joined: 2003.05
Post: #36
Whoever wants to take credit for that minimizing to the dock code should submit it to SDL for a change if they haven't already. Might as well share with everyone.

MarkJ:
Hmm... well, SDL is for making cross platform games really. Since the UI is so different on different platforms (I think there is SDL for cell phones?), it's not necessarily a priority to add features that will be implemented in different ways by people even on the SAME platform. As it is, there are a set of menus with some basic functionality and that's more than what windows people get from SDL. Smile

Any additional universally desired features that you or anybody else wants to add to SDL will probably be welcomed at http://www.libsdl.org but it's not supposed to be a full replacement for Cocoa or Carbon.

"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
  Does SDL have any support for pull down menus? WhatMeWorry 2 2,557 Nov 6, 2005 01:12 AM
Last Post: PowerMacX