ulfben

float / int mismatch

Sep 30th, 2020
536
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //bug:
  2. public int worldToScreenX(float worldDistance) {
  3.     return (int) worldDistance * _camera.getPixelsPerMeterX();
  4. }
  5.  
  6. public int worldToScreenY(float worldDistance) {
  7.     return (int) worldDistance * _camera.getPixelsPerMeterY();
  8. }
  9.  
  10.  
  11. fix:
  12. public int worldToScreenX(float worldDistance) {
  13.     return (int) (worldDistance * _camera.getPixelsPerMeterX());
  14. }
  15.  
  16. public int worldToScreenY(float worldDistance) {
  17.     return (int) (worldDistance * _camera.getPixelsPerMeterY());
  18. }
RAW Paste Data