1. lilb1190's Avatar
    I am starting out with some game development using XNA and Silverlight, but cant figure out how to handle orientation. Ideally I would want the game to always run in Landscape mode, so I set the Supported Orientation to landscape. I have a Grid as my Layout Root, and I apply an image brush background to it which is the background of the game.

    It looks okay in portrait, but if I switch to landscape, half of the background dissapears. I assume its because the phone is changing orientation but the background isnt. Does this mean I need to transform the background every time I change the orientation of the phone? Is it in no way handled by the phone or by silverlight automagically?

    Also, I have added textures for the characters using XNA. When the phone changes orientation, so to they. They only "stand up straight" in portrait orientation. Otherwise they flip in the driection of the phone. Do I need to rotate every texture on screen in order to orient them properly? Is there a good tutorial for this anywhere?

    Thanks!
    06-16-2012 12:55 AM
  2. CommonBlob's Avatar
    firstly I would suggest drawing the background with a texture2d rather than in a Silverlight element. If you want to do anything clever later on it will be easier.
    if you do it in Silverlight you will need to override the orientation changed event to ensure it works. I believe in the Silverlight xna sample it shows you what you need.

    But I recommend the texture 2d thing and then just do spritebatch.draw(texture, vector2.zero, color.white)
    06-16-2012 12:48 PM
LINK TO POST COPIED TO CLIPBOARD