So we have created a Camera with a viewport width and height of 50. Two, it allows our sprites to move very fast. Create the DeviceCameraController object responsible for the Camera surface where the preview is drawn. So the only only safe place we have to instantiate LibGDX objects is in the create method. Create the libGDX view with alpha channel (this is not the default), so that the camera preview will be shown behind it. In our example 50 x 50 World Units these are the viewport width and height. LibGDX Beginner Tutorial: Sprite Sheets & Physics with Box2d. We create a OrthographicCamera and in the Constructor we define how many World Units we see if we look through this camera into our world. We create a OrthographicCamera through which we see 50x50 World Units Later more.įirst, we create an OrthographicCamera a SpriteBatch and a Texture: private OrthographicCamera camera You self can define how much one World Unit is. 參考解法 方法 1: How can I use a Camera in LibGdx? What's viewport width and height?įirstly it's important that you know the Camera works with World units not with Pixels. Camera 如何在 Libgdx 和 Viewport 中工作 (How Camera works in Libgdx and together with Viewport)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |