2014-07-06 2 views
0

이 이미지 (http://imgur.com/4zxGATb)를 가지고 있으며 전체 화면을 차지하려고합니다. Heres는 내 코드libgdx 이미지를 전체 화면으로 가져 오는 방법?

static Texture img; 
static Sprite sprite; 
public static void load(){ 

    img = new Texture(Gdx.files.internal("menu/stick.PNG")); 
    //libgdx scales it , it wont mess up 
    img.setFilter(TextureFilter.Linear, TextureFilter.Linear); 

    sprite = new Sprite(img); 
    sprite.flip(false, true); 
    sprite.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); 
} 

출력은 여전히 ​​전체 화면을 복용 막대기 그림을 보여 나던. 출력 : http://imgur.com/QPAUbaw

나는이 잘못된 방향으로 가고 있습니까? 스프라이트 (이미지를 화면에 렌더링하는 객체)를 화면의 크기로 설정하면 이미지가 전체 화면을 차지해야한다고 생각했습니다. 이 같은

+0

당신이 스프라이트 배치에 투영 행렬을 설정하는 방법? 그것은 당신이 어떻게하는지에 달려 있습니다. – Tenfour04

답변

1

뭔가 작업을해야합니다 :

batch.draw(sprite.getTexture() x, y, sprite.getWidth(), sprite.getHeight()); 
+0

Thx하지만 whats x 및 y? 이러한 인수를 사용하지 않아도되었습니다. – committedandroider

+0

Sprite가 카메라 뷰포트와 동일한 크기 인 경우에만 작동합니다. – Tenfour04