Add saving of previous GrafPort before drawing to avoid conflicts with DAs

This commit is contained in:
Jon Thysell 2021-11-19 13:15:41 -08:00
parent 6989dcb185
commit 85e3d0f003

View File

@ -27,13 +27,19 @@ void GameWindow_Init(GameWindow *pGameWindow)
// Load snd resources // Load snd resources
Sounds_Init(&(pGameWindow->Sounds)); Sounds_Init(&(pGameWindow->Sounds));
// Set port for first draw
SetPort(pGameWindow->Window);
GameWindow_SetScene(pGameWindow, Title); GameWindow_SetScene(pGameWindow, Title);
} }
void GameWindow_Draw(const GameWindow *pGameWindow, bool fullRefresh) void GameWindow_Draw(const GameWindow *pGameWindow, bool fullRefresh)
{ {
GrafPtr oldPort;
const Rect *pContentRect = &(pGameWindow->Window->portRect); const Rect *pContentRect = &(pGameWindow->Window->portRect);
GetPort(&oldPort);
SetPort(pGameWindow->Window); SetPort(pGameWindow->Window);
if (fullRefresh) if (fullRefresh)
@ -57,6 +63,8 @@ void GameWindow_Draw(const GameWindow *pGameWindow, bool fullRefresh)
GameEndScene_Draw(pGameWindow, fullRefresh); GameEndScene_Draw(pGameWindow, fullRefresh);
break; break;
} }
SetPort(oldPort);
} }
void GameWindow_Click(GameWindow *pGameWindow, const Point *pPosition) void GameWindow_Click(GameWindow *pGameWindow, const Point *pPosition)