GBA Context: Callbacks when pausing and unpausing, for audio

This commit is contained in:
Jeffrey Pfau 2015-09-02 23:15:36 -07:00
parent 1df666e91d
commit 95f6a8f8d6
4 changed files with 12 additions and 0 deletions

View File

@ -184,6 +184,9 @@ void GBAGUIRunloop(struct GBAGUIRunner* runner) {
} }
} }
if (runner->paused) {
runner->paused(runner);
}
GUIInvalidateKeys(&runner->params); GUIInvalidateKeys(&runner->params);
uint32_t keys = 0xFFFFFFFF; // Huge hack to avoid an extra variable! uint32_t keys = 0xFFFFFFFF; // Huge hack to avoid an extra variable!
struct GUIMenuItem item; struct GUIMenuItem item;
@ -219,6 +222,9 @@ void GBAGUIRunloop(struct GBAGUIRunner* runner) {
if (runner->params.guiFinish) { if (runner->params.guiFinish) {
runner->params.guiFinish(); runner->params.guiFinish();
} }
if (runner->unpaused) {
runner->unpaused(runner);
}
} }
GBAContextStop(&runner->context); GBAContextStop(&runner->context);
if (runner->gameUnloaded) { if (runner->gameUnloaded) {

View File

@ -37,6 +37,8 @@ struct GBAGUIRunner {
void (*gameUnloaded)(struct GBAGUIRunner*); void (*gameUnloaded)(struct GBAGUIRunner*);
void (*prepareForFrame)(struct GBAGUIRunner*); void (*prepareForFrame)(struct GBAGUIRunner*);
void (*drawFrame)(struct GBAGUIRunner*, bool faded); void (*drawFrame)(struct GBAGUIRunner*, bool faded);
void (*paused)(struct GBAGUIRunner*);
void (*unpaused)(struct GBAGUIRunner*);
uint16_t (*pollGameInput)(struct GBAGUIRunner*); uint16_t (*pollGameInput)(struct GBAGUIRunner*);
}; };

View File

@ -264,6 +264,8 @@ int main() {
.gameUnloaded = _gameUnloaded, .gameUnloaded = _gameUnloaded,
.prepareForFrame = 0, .prepareForFrame = 0,
.drawFrame = _drawFrame, .drawFrame = _drawFrame,
.paused = _gameUnloaded,
.unpaused = _gameLoaded,
.pollGameInput = _pollGameInput .pollGameInput = _pollGameInput
}; };
GBAGUIInit(&runner, 0); GBAGUIInit(&runner, 0);

View File

@ -170,6 +170,8 @@ int main() {
.gameUnloaded = _gameUnloaded, .gameUnloaded = _gameUnloaded,
.prepareForFrame = 0, .prepareForFrame = 0,
.drawFrame = _drawFrame, .drawFrame = _drawFrame,
.paused = _gameUnloaded,
.unpaused = 0,
.pollGameInput = _pollGameInput .pollGameInput = _pollGameInput
}; };
GBAGUIInit(&runner, 0); GBAGUIInit(&runner, 0);