java - libgdx sprite dimension meters or pixels? -


I'm reading "Learning Libegade Game Development". I tried the following snippet:

  // The first camera object was created with a 5x5 viewport. Orthographic camera camera = new orthographic camera (5, 5);  

I have a texture of 32 pixels with dimensions of 32 pixels. I create a phantom outside of this

  Sprite spr = new Sprite ( Texture); // I set the size of the SRR as spr.setSize (1,1); According to the book, the above dimensions are meters and there are no pixels 

What I can not understand is how mapping is being done from meters to pixels on the screen? When I had to draw the sprite on the screen, the size is not even half a meter alone.

In addition, the size of the built-in texture is 32 x 32 pixels when I change the shape, the shape of my preferences also changes

Then, spr.setPosition (x, y) What will be the dimensions? Will they be meters or pixels?

Texture size in the library such as dimensions and use of pixels - game units

setPosition Game units will move an object. When you move an object X game units, the number of pixels varies depending on the camera's projection matrix between the other settings.

If you think about it, then it will not make sense to grow in pixels. If the camera is more zoomed than a camera, then in each camera scene, two pixels will need two separate vacancies.

EDIT: Sorry, I raised some assumptions in your understanding, partially misunderstood this question, and clearly used misleading terms. The main thing is that the meter conference for the units has been created not , this is the one you apply because the box 2D does not mean the ratio of one pixel to one meter. The word I used is implicit that the interior set regards the status meter, but you should scaling yourself. Often times, what I see in lipidax is 30 pixels = 1 meter.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -