화면 높이에 따라 이미지의 크기를 조정 하려는데 문제가 있습니다. 현재 문제는 단순히 이미지가 표시되지 않는다는 것입니다. 다음은 코드입니다.크기가 조정 된 스프라이트가 표시되지 않습니다.
class Board
{
private Texture2D texture;
private int screenWidth = Game1.Instance.GraphicsDevice.Viewport.Width;
private int screenHeight = Game1.Instance.GraphicsDevice.Viewport.Height;
private Vector2 location;
private Rectangle destination;
public Board(Texture2D texture)
{
this.texture = texture;
this.location = new Vector2(200, 0);
this.destination = new Rectangle((int)location.X, (int)location.Y, texture.Width * (screenHeight/texture.Height), screenHeight);
}
public void Draw(SpriteBatch spriteBatch)
{
spriteBatch.Begin();
spriteBatch.Draw(texture,
destination,
Color.White);
spriteBatch.End();
}
}
이미지가 너무 넓기는하지만 이전에 표시되었으므로 주 루프 내의 코드는 정상입니다. 그래서 짧은 질문에 내 질문은 ...이 코드가 무엇이 잘못되어 더 좋은 방법이 있을까요?
제목을 편집했습니다. "[제목에"태그 "가 포함되어 있어야합니까?] (http://meta.stackexchange.com/questions/19190/)"합의가 "아니오, 그렇지 않아야합니다"로 표시되어야합니다. –