Sry I Pwned U:Quick Question:
I have written a simple game to try and port to my Zune. The game is designed for a widescreen view, however the zune defaults to a long vertical view. What do I need to do to harness the widescreen capabilities of the zune.
Thanks In Advance,
Sry I Pwned U
I use this method that I learned from Nick_G:
1) Add a RenderTarget2D member variable to your Game Class.
| //on the Zune, we use a render target to easily rotate |
| //from portrait view to landscape view. |
| RenderTarget2D renderTarget; |
| |
2) Initialize the RenderTarget in the LoadContent method
| //create the render target at the landscape size of 320x240 |
| renderTarget = new RenderTarget2D(GraphicsDevice, 320, 240, 0, SurfaceFormat.Color); |
| |
3) The draw method:
| //if we're on a Zune, we render the whole game to the render target |
| //and then use sprite batch to rotate it and draw it more appropriately |
| #if ZUNE |
| GraphicsDevice.SetRenderTarget(0, renderTarget); |
| #endif |
| // TODO : Add your draw code here |
| |
| //base.Draw calls our GameStateManager's Draw method to draw the current state |
| base.Draw( gameTime ); |
|
| #if ZUNE |
| //resolve the target |
| GraphicsDevice.SetRenderTarget(0, null); |
| |
| //draw the texture rotated |
| spriteBatch.Begin(); |
| spriteBatch.Draw( renderTarget.GetTexture(), new Vector2(120, 160), null, Color.White, |
| MathHelper.PiOver2, // Rotate into Landscape |
| new Vector2(160, 120), 1f, SpriteEffects.None, 0); |
| spriteBatch.End(); |
| #endif |
| |