GP32 GpAppExit()


jcbnetwork

Member
Joined
Aug 10, 2003
Messages
252
Location
New York City
Website
Visit site
I am writing a game for the GP32 and I wanted to have the option of exiting the game and restarting the GP32.

My GpMain(void *arg) looks something like this...

void GpMain(void *arg) {
.....MyMain(); // I call my own Main
}

in my own Main i have the standard game loop with logic and stuff, when the user selects to EXIT I break out of the loop and thus return from MyMain() but for some reason my game RESETS ITSELF so the game RESTARTS. If i select EXIT again, then the 2nd time it does EXIT the game and resets the GP32.

I thought about using GpAppExit() instead of breaking from the loop but anytime I call GpAppExit() my game RESTARTS.

For some reason it seems that GpMain() is getting called AGAIN after it reaches the end of the program. I solved this problem by just creating a boolean value as follows...

bool running = true;

void GpMain(void *arg) {
.....if(running) {
..........running = MyMain(); // this returns false when i break out of the game loop
.....}
}

This method works just fine but I am left wondering, why would GpMain() be called AGAIN after it's done?
 
Back
Top