How to draw on just a portion of the screen with SpriteBatch in libgdx?

前端 未结 4 1638
-上瘾入骨i
-上瘾入骨i 2021-01-23 07:53

When I do this:

SpriteBatch spriteBatch = new SpriteBatch();
spriteBatch.setProjectionMatrix(new Matrix4().setToOrtho(         


        
4条回答
  •  自闭症患者
    2021-01-23 08:11

    You could either

    • double the viewport width of the SpriteBatch
    • use a Sprite and set its width scale to 0.5f (be careful about the origin) and use its draw(SpriteBatch) method to draw it.

提交回复
热议问题