applied patch #13365 by clcrutch

This commit is contained in:
Glatzemann 2012-12-03 08:17:09 +00:00 committed by Konstantin Koch
parent 4096a16846
commit 8dced08668
2 changed files with 38 additions and 3 deletions

View File

@ -9,6 +9,12 @@ using ANX.Framework.NonXNA.Development;
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
#region Patch-Log
12/03/2012 #13365 clcrutch
#endregion
namespace ANX.Framework
{
[PercentageComplete(100)]
@ -100,7 +106,13 @@ namespace ANX.Framework
throw new InvalidOperationException("Service not found: IGraphicsDeviceService");
}
this.device.DeviceCreated += OnDeviceCreated;
this.device.DeviceReset += new EventHandler<EventArgs>(OnDeviceReset);
this.device.DeviceDisposing += OnDeviceDisposing;
if (this.device.GraphicsDevice != null)
{
LoadContent();
}
}
isInitialized = true;
}
@ -137,6 +149,11 @@ namespace ANX.Framework
this.LoadContent();
}
private void OnDeviceReset(object sender, EventArgs e)
{
this.LoadContent();
}
private void OnDeviceDisposing(object sender, EventArgs arg)
{
this.UnloadContent();

View File

@ -14,6 +14,12 @@ using ANX.Framework.NonXNA.SoundSystem;
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
#region Patch-Log
12/03/2012 #13365 clcrutch
#endregion
namespace ANX.Framework
{
[PercentageComplete(60)]
@ -30,6 +36,7 @@ namespace ANX.Framework
private bool firstDrawDone;
private bool drawingSlow;
private bool inRun;
private bool isInitialized;
private GameHost host;
private bool ShouldExit;
@ -140,9 +147,17 @@ namespace ANX.Framework
protected virtual void Initialize()
{
//TODO: implement
if (!this.isInitialized)
{
foreach (GameComponent component in this.Components)
{
component.Initialize();
}
this.LoadContent();
this.isInitialized = true;
this.LoadContent();
}
}
protected virtual void Update(GameTime gameTime)
@ -539,7 +554,10 @@ namespace ANX.Framework
drawableGameComponents.Add(e.GameComponent);
}
e.GameComponent.Initialize();
if (isInitialized)
{
e.GameComponent.Initialize();
}
}
private void HostActivated(object sender, EventArgs e)