brackeen / glfm

OpenGL ES and input for iOS, tvOS, Android, and WebGL
zlib License
566 stars 77 forks source link

Leave app? #45

Closed marcakafoddex closed 2 years ago

marcakafoddex commented 2 years ago

Is there a way to make glfm exit the app and return to the OS? Searched in the code and the docs, couldn't find anything, I'm hoping I'm overlooking something! :)

brackeen commented 2 years ago

AFAIK there is no clean way to do this on either iOS or Android. Calling exit(0) might be possible. Generally though, I think the guidelines state that only users should be the ones that exit apps.

marcakafoddex commented 2 years ago

thx for the quick reply! maybe my question was ill formed :) i mean when the user hits BACK on Android, nothing happens in my glfm based app, which makes me assume I have to listen to it myself and "exit" the app (not necessarily terminate it, but go back to the Android main screen). Is that possible?

edit: maybe "minimize" the app is a better term for what I mean :)

brackeen commented 2 years ago

Ah! ok. Perhaps this isn't documented well. Are you working with key input? If so, you will need a special case for the back button, like:

if (keyCode == GLFMKeyNavBack) {
    // Android: Return `false` (key not handled) to let the app exit
    return false;
}
marcakafoddex commented 2 years ago

ah awesome! :) will try that :) then this probably closes the "issue" :) thx for an awesome library, it's so easy to use! :)

marcakafoddex commented 2 years ago

will close it once i got it to work!

marcakafoddex commented 2 years ago

Okay that works flawlessly. Thanks!! :)