XNA Creators Club Online
Page 1 of 1 (2 items)
Sort Posts: Previous Next

Zune In Landscape Mode?

Last post 11/15/2008 3:29 PM by Borrillis. 1 replies.
  • 11/15/2008 3:09 PM

    Zune In Landscape Mode?

    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
  • 11/15/2008 3:29 PM In reply to

    Re: Zune In Landscape Mode?

    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  
     
Page 1 of 1 (2 items) Previous Next
var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG