Yet more fullscreen drawsprocketing
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:
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:
Anything that is obviously wrong?
Thanks for any pointers...
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;
}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;
}Thanks for any pointers...
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.
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.
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
/Ivan

