protected override void OnContextSet(EventArgs e)
{
// This is called when a Context is created. This will happen in
// two ways, first when the activity is first created. Second if
// (and only if) the context is lost
// When an acivity is now paused we correctly preserve the context
// rather than destoying it along with the Surface which is what
// used to happen.
base.OnContextSet(e);
Android.Util.Log.Debug("MonoGame", "MonoGameAndroidGameView Context Set");
if (_lostContext)
{
_lostContext = false;
if (_game.GraphicsDevice != null)
{
_game.GraphicsDevice.Initialize();
IsResuming = true;
if (_gameWindow.Resumer != null)
{
_gameWindow.Resumer.LoadContent();
}
// Reload textures on a different thread so the resumer can be drawn
System.Threading.Thread bgThread = new System.Threading.Thread(
o =>
{
Android.Util.Log.Debug("MonoGame", "Begin reloading graphics content");
Microsoft.Xna.Framework.Content.ContentManager.ReloadGraphicsContent();
Android.Util.Log.Debug("MonoGame", "End reloading graphics content");
// DeviceReset events
_game.graphicsDeviceManager.OnDeviceReset(EventArgs.Empty);
_game.GraphicsDevice.OnDeviceReset();
IsResuming = false;
});
bgThread.Start();
}
}
}
protected override void CreateFrameBuffer()