2012-11-22 47 views
0

我正試圖在屏幕上使用Libgdx「調整」我的遊戲視圖。事實上,我需要在屏幕的底部和左側放置一個黑條。所以,如果你使用你的MS Paint或Gimp調整一個正方形的大小,我想在我的遊戲階段這樣做。 (我試着上傳一個數字來設置我的問題更清楚,但顯然禁止#1對我來說)如何使用Libgdx調整窗口內部的舞臺尺寸

我想我的東西混合了舞臺大小,相機尺寸和視口。任何建議將不勝感激 !

回答

0

如果您使用的階段,那麼你可以嘗試更換攝像頭查看自己與其他視口的尺寸。

Camera newCamera = new OrthographicCamera(300, 200); 
//... here is some other camera initialization code 
newCamera.update();//recalculate camera matrices 
stage.setCamera(newCamera); 

//after that you may need to update sprite batch projection matrix 

_gameStage.getSpriteBatch().setProjectionMatrix(newCamera.combined); 
+0

你好,謝謝你的回答。儘管如此,我仍然遇到了麻煩。視圖是僅移位(等裁剪)在屏幕的上側。也許它必然的事實,我使用的是OrthographicCamera? – Ugo

+0

我的不好,問題是我忘了調用setToOrtho方法。現在它正常工作,謝謝! – Ugo

相關問題