So I have some code for scaling graphics to the size of a users screen by dividing the size of an \'Ideal\' screen by the size of the users screen. Hers is a code snippet of wha
In these lines
scaleFactorWidth = 2880 / ui.getWidth();
scaleFactorHeight = 1800 / ui.getHeight();
The calculation itself is Integer-based (according to the later calls of Integer.toString()). Just the result is then casted to double.
Use this code instead, in order to have the actual computation use double values:
scaleFactorWidth = 2880.0 / ui.getWidth();
scaleFactorHeight = 1800.0 / ui.getHeight();
or
scaleFactorWidth = 2880.0 / (double)ui.getWidth();
scaleFactorHeight = 1800.0 / (double)ui.getHeight();