Yet more fullscreen drawsprocketing

Oldtimer
Posts: 834
Joined: 2002.09
Post: #1
Hi all, again.

Still trying to wrench Drawsprocket into obediance... Now, most things work quite well, but I can't seem to pause/inactivate a DSp context and then resume it under OS 9. I don't get any errors.

It does fade back and does the resolution switching, but I don't seem to get a blanking window (not sure about this, though). So, this leads me to believe that the AGL context doesn't reconnect with the DSp context, although I do call aglSetDrawable again, and show the window again.

The relevant code is the Suspend method:
Code:
void Suspend (void)
{
    if (shouldFade)
    {
        DSpContext_FadeGammaOut (NULL, NULL);
    }
    
    if (!gIsOnMacOSX)
    {
        DSpContext_SetState(dspContextRef, kDSpContextState_Inactive);
        HideWindow (GetWindowFromPort (dspPort));
        DrawMenuBar();
    }
    aglDrawable = aglGetDrawable (aglContext);
    aglSetDrawable (aglContext, NULL);
    ShowCursor();
    
    if (shouldFade)
    {
        DSpContext_FadeGammaIn (NULL, NULL);
    }
    return kOK;
}
where aglContext is my AGL draw context (surprise?) and dspPort is a window that I use to draw on. (All in accordance with Apple's sample code)

Then, I try to resume the context with:
Code:
void Resume (void)
{
    if (shouldFade)
    {
        DSpContext_FadeGammaOut (NULL, NULL);
    }
    if (!gIsOnMacOSX && inFullscreenMode)
    {
        DSpContext_SetState(dspContextRef, kDSpContextState_Active);
    }
    else if (gIsOnMacOSX && inFullscreenMode)
    {
        aglSetFullScreen (aglContext, width, height, 60, 0);
    }
    else
    {
        aglSetDrawable (aglContext, GetWindowPort(theGLController->theWindow));
        ShowWindow (theGLController->theWindow);
    }

    HideCursor();
    
    if (shouldFade)
    {
        DSpDebugStr(DSpContext_FadeGammaIn (NULL, NULL));
    }
    return kOK;
}
Anything that is obviously wrong?

Thanks for any pointers...
Quote this message in a reply
Moderator
Posts: 365
Joined: 2002.04
Post: #2
I can't see anything wrong with your code, but I remember having trouble with this too. The worst thing about DrawSprocket is that it likes to do different things on OSX and OS9, so you have to do strange things to work around its quirks!

In the end I decided to completely shut down DrawSprocket when the user returns to the desktop, and start it again from scratch when they continue the game. It doesn't take any longer than switching state with DSpContext_SetState(), and I can't see any reason why keeping DrawSprocket running is better than shutting it down altogether.

Neil Carter
Nether - Mac games and comic art
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #3
That'll do it for me. That way, I can let the user change from fullscreen to a windowed mode on the fly. Thanks!

/Ivan
Quote this message in a reply
Post Reply