This does not calculate properly in floats.
System.out.println(tileWidth);
System.out.println(Gdx.graphics.getWidth());
float drawPPU = 200 / Gdx.graphics.getWidth();
float drawWidth = drawPPU * tileWidth;
float drawHeight = drawPPU * tileHeight;
System.out.println(drawPPU);
System.out.println(drawWidth);
Gives this output:
125
360
0.0
0.0
But when i cast my INTS
like FLOATS
this it does calculate properly:
float drawPPU = 200 / (float)Gdx.graphics.getWidth();
float drawWidth = drawPPU * (float)tileWidth;
float drawHeight = drawPPU * (float)tileHeight;
I am pretty sure I never did these basic calculations like this and it took my a while until i found what was actually wrong with my viewport. I mean:
(float = 200 / 360) == (float = 200.0 / 360.0)
So is there something wrong with my setup/compiling or am i mixing things up in some way?