From 9ecc28e61b5a1af71e92f9e3980abf2152e7815f Mon Sep 17 00:00:00 2001 From: gered Date: Sat, 17 Aug 2013 23:39:12 -0400 Subject: [PATCH] call important GraphicsDevice events in BaseApplication --- Blarg.GameFramework/BaseApplication.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Blarg.GameFramework/BaseApplication.cs b/Blarg.GameFramework/BaseApplication.cs index 8c7ea52..e1743f6 100644 --- a/Blarg.GameFramework/BaseApplication.cs +++ b/Blarg.GameFramework/BaseApplication.cs @@ -10,7 +10,8 @@ namespace Blarg.GameFramework { const string LOG_TAG = "BASE_APP"; - private bool _isReleased = false; + bool _isReleased = false; + bool _isFirstContextCreatedYet = false; protected IGameApp GameApp { get; set; } @@ -76,29 +77,41 @@ namespace Blarg.GameFramework protected void OnUnload() { Logger.Info(LOG_TAG, "OnUnload"); + if (GraphicsDevice != null) + GraphicsDevice.OnUnload(); GameApp.OnUnload(); } protected void OnLostContext() { Logger.Info(LOG_TAG, "OnLostContext"); + if (GraphicsDevice != null) + GraphicsDevice.OnLostContext(); GameApp.OnLostContext(); } protected void OnNewContext() { Logger.Info(LOG_TAG, "OnNewContext"); + if (_isFirstContextCreatedYet) + { + if (GraphicsDevice != null) + GraphicsDevice.OnNewContext(); + } + _isFirstContextCreatedYet = true; GameApp.OnNewContext(); } protected void OnRender(float delta) { + GraphicsDevice.OnRender(delta); GameApp.OnRender(delta); } protected void OnResize(ScreenOrientation orientation, Rect size) { Logger.Info(LOG_TAG, "OnResize"); + GraphicsDevice.OnResize(ref size, orientation); GameApp.OnResize(orientation, size); }