Java rounding the results of a division when it shouldn't be

后端 未结 4 1019
心在旅途
心在旅途 2021-01-28 12:55

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

4条回答
  •  再見小時候
    2021-01-28 13:52

    Cast it to Double.

       scaleFactorWidth = (Double)2880 / ui.getWidth();
        scaleFactorHeight = (Double)1800 / ui.getHeight();
    

提交回复
热议问题