Skip to content

Loading…

Fixed DrawingSurfaceBackgroundGrid in Game.xaml #2220

Closed
wants to merge 1 commit into from

5 participants

@RTLShadow

credit to nZeus/MonoGame, fixes issue with functions not being called in WP8 builds.

@RTLShadow RTLShadow Fixed DrawingSurfaceBackgroundGrid in Game.xaml
credit to nZeus/MonoGame, fixes issue with functions not being called in WP8 builds.
88c7521
@mgbot

Can one of the admins verify this patch?

@mgbot

Can one of the admins verify this patch?

@mgbot

Test PASSed.
Refer to this link for build results: http://build.monogame.net/job/PullRequestTester/571/

@Nezz

Where is your DrawingSurfaceBackgroundGrid? It should be set using this line:
UIElement drawingSurface = page.Content as DrawingSurfaceBackgroundGrid;

@tomspilman
Mono Project member

@Nezz - Are you saying this shouldn't be merged?

@Nezz

Yes, it shouldn't be merged unless @RTLShadow can explain where he put his DrawingSurfaceBackgroundGrid and why :)

@RTLShadow

@Nezz I was unaware that was needed- I can try it. Here is the issue it fixed (and the where i got the code from): #2081

@tomspilman
Mono Project member

@Nezz - Are you happy with this now?

@Nezz

I still don't understand why the DrawingSurfaceBackgroundGrid is a child element and not the root.

From http://blogs.windows.com/windows_phone/b/wpdev/archive/2012/11/05/windows-phone-8-developer-platform-highlights.aspx:

DrawingSurfaceBackgroundGrid is a very special element that must always be the root element of a page and allows developers to render directly to the background from Direct3D using C++.

@tomspilman
Mono Project member

Ok... gonna close this. @RTLShadow can resubmit if he can answer your questions about it.

@tomspilman tomspilman closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 8, 2014
  1. @RTLShadow

    Fixed DrawingSurfaceBackgroundGrid in Game.xaml

    RTLShadow committed
    credit to nZeus/MonoGame, fixes issue with functions not being called in WP8 builds.
Showing with 3 additions and 1 deletion.
  1. +3 −1 MonoGame.Framework/WindowsPhone/XamlGame.cs
View
4 MonoGame.Framework/WindowsPhone/XamlGame.cs
@@ -117,6 +117,8 @@ static public T Create(string launchParameters, PhoneApplicationPage page)
mediaElement = (MediaElement)child;
else if (drawingSurface == null && child is DrawingSurface)
drawingSurface = (DrawingSurface)child;
+ else if (drawingSurface == null && child is DrawingSurfaceBackgroundGrid)
+ drawingSurface = (DrawingSurfaceBackgroundGrid)child;
}
if (!(drawingSurface is DrawingSurfaceBackgroundGrid) && !(drawingSurface is DrawingSurface))
@@ -194,4 +196,4 @@ private static void OnDrawingSurfaceUnloaded(object sender, RoutedEventArgs e)
initializedSurfaces.Remove(drawingSurface);
}
}
-}
+}
Something went wrong with that request. Please try again.