Click here to Skip to main content
15,889,595 members
Please Sign up or sign in to vote.
2.33/5 (3 votes)
i am developing a game in Silverlight+XNA (integrated) platform for windows Phone 7. I Need Some Help in Loading a Full Screen Image (800X480) directly as the Background in XNA , i've tried many times but did not succeeded doing so , sometimes it goes on Square Shape (480X480) only , and sometimes it automatically do the stretching. i think its the problem of "DiplayOrientation" but that is already set to Portrait. and i am still unable to place the background exactly on the screen according to the screen size .

My background image size is 800X480 px , i've tried with 480X800 also .
Here are my Code Lines which are related to the Background .

CSS
Texture2D  backgroundTexture;

//in NavigatedTo() Method
 backgroundTexture = contentManager.Load<Texture2D>("2");// 2 is Image name

//in OnUpdate() Method
rectangleBackground = new Microsoft.Xna.Framework.Rectangle(0,0, backgroundTexture.Height, backgroundTexture.Width);
          
// and Finally in onDraw() Method
spriteBatch.Draw(backgroundTexture, rectangleBackground, Color.White);            
Posted
Updated 16-Apr-13 4:33am
v3
Comments
Richard C Bishop 16-Apr-13 10:09am    
You have not asked a question or provided any code for someone to look at.
SohaibX 16-Apr-13 10:33am    
Ok.i updated ! :P

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900