Round instead of truncating.

This commit is contained in:
King_DuckZ 2014-08-25 18:06:55 +02:00
parent af4f16a6d6
commit cc0f174be5

View file

@ -26,6 +26,7 @@
#endif
#include <SDL2/SDL.h>
#include <algorithm>
#include <boost/math/special_functions/round.hpp>
#if defined(WITH_DEBUG_VISUALS)
namespace cloonel {
@ -80,8 +81,8 @@ namespace cloonel {
}
}
parLine[0] = static_cast<short2>(line[0]);
parLine[1] = static_cast<short2>(line[1]);
parLine[0] = short2(static_cast<int16_t>(boost::math::iround(line[0].x())), static_cast<int16_t>(boost::math::iround(line[0].y())));
parLine[1] = short2(static_cast<int16_t>(boost::math::iround(line[1].x())), static_cast<int16_t>(boost::math::iround(line[1].y())));
}
} //unnamed namespace