On Android when the application goes into the background, the EGL
window surface becomes invalid. It is possible to resume rendering when
coming to the foreground by resetting and reinitializing bgfx from
scratch, but this is costly in terms of performance.
This patch provides an alternative by letting the application provide a
new native window, causing bgfx to recreate just the EGL window surface
while keeping the EGL context intact. This allows the application to
resume rendering without needing to reload textures, shaders, etc.
To test, build and run the Hello World example on Android, switch to
another app and then back again. The screen should not remain blank
after switching back.
On Android WillSuspend and WillResume maps to focus and DidSuspend and
DidResume maps to onPause and onResume.
On OSX WillSuspend and DidSuspend maps to resign key, WillResume and
DidResumg maps to make key.