I created a new Windows Phone 8 Project using the 3.2 templates with Visual Studio 2013 and tried to run it on the emulator.
It just shows a black screen and doesn’t get to the cornflower blue screen we all know and love. When I do a step through, it does get as far as calling the constructor on the main game class, but t doesn’t get to LoadContent.
Do I need to install anything else? How can I work out what’s going wrong?
I have the same problem. The screen is always black. I tested it with WVGA, WXGA and 720p emulators. Why is the screen always black? I have Visual Studio 2012 Express for Windows Phone. Emulator picture
Happens to me too, both ARM and x86. Looks like the landscape template is not working correctly because of the use of DrawingSurface and not DrawingSurfaceBackgroundGrid.
If your game is portrait then on GamePage.xaml you can swap the Grid for the DrawingSurfaceBackgroundGrid as described in the comment at the bottom of the template. That is working, but for some reason the Grid version which you need if you want to support a landscape game doesn’t seem to be working.
Just do what iv done and make the game in portrait and rotate everything to landscape by render to a back buffer then rotate and render to screen.
RenderTarget2D BackBuffer;
then in your Intiialize()
//the size of the backbuffer
BackBuffer = new RenderTarget2D(GraphicsDevice, 1280, 720);
Then in your draw
GraphicsDevice.SetRenderTarget(BackBuffer);
//enter your draw code here
GraphicsDevice.SetRenderTarget(null);
gameBatch.Begin();
gameBatch.Draw(BackBuffer, new Vector2(360, 640), null, Color.White, MathHelper.PiOver2, new Vector2(640,360), 1f, SpriteEffects.None, 0f);
gameBatch.End();
MathHelper.PiOver2 will rotate one way and -MathHelper.PiOver2 will rotate the other way
you just need to work out the touch points as the will still report in portrait mode.
EDIT:
Of course you will need to handle the different size of screens, this code is only for 1280x720 as I haven’t got round to auto scaling for all screen sizes.
EDIT2:
Use the above code provided by Fox9 to make the game run in portrait mode.
Yes, that could be a way to do it, but it is very ugly. Also, it nukes your performance because you’re basically drawing everything twice. The DrawingSurface should work (although also lowering performance)… There’s a problem with graphics device at these lines:
// Create the Direct3D 11 API device object and a corresponding context.
using (var defaultDevice = new SharpDX.Direct3D11.Device(SharpDX.Direct3D.DriverType.Hardware, creationFlags, featureLevels))
_device = defaultDevice.QueryInterface<SharpDX.Direct3D11.Device1>();
Hello, guys!
I solve this problem by this way:
I created a new project called “Windows Phone XAML and Direct3D App”, then I deleted all code that related to cpp project in my solution and add MonoGame.Binaries references with Nuget.
After that I don’t have black screen and game works with any screen orientations!
I used VS2013. I suppose that MonoGame 3.2 Installer have defective Windows Phone 8 template.
You’re welcome I also try to do the same thing with Windows Phone App template and it also work But you need to specify platform x86 or ARM for Emulator or Device respectively in the solution properties.
So what is the difference between the original template and mono template? We need a new template then… What can I do to fix my app? (it is well off into development…)
EDIT: I tried now making my own template as you said from xaml+direct3d and it doesn’t load… Can you upload your project?
MiShu, your template worked like a charm–and I was one step away from deleting my MonoGame downloads for the sixth time and giving up on this whole toolkit as an unusable, non-functional piece of junk. So thank you!