Quantcast
Channel: Question and Answer » libgdx
Viewing all articles
Browse latest Browse all 434

Removing inline declarations makes code work. Why?

$
0
0

This does not work:

camera = new OrthographicCamera(100, 100 * (Gdx.graphics.getHeight() /Gdx.graphics.getWidth())); 

This does:

float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();

camera = new OrthographicCamera(100, 100 * (h/w));

I do not get the difference. One displays fine on my screen, the other remains black.

Why is this? Is there any syntactical reason why this does not work, or is it a bug?


Viewing all articles
Browse latest Browse all 434

Trending Articles