Round instead of truncating.
This commit is contained in:
parent
af4f16a6d6
commit
cc0f174be5
1 changed files with 3 additions and 2 deletions
|
@ -26,6 +26,7 @@
|
||||||
#endif
|
#endif
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <boost/math/special_functions/round.hpp>
|
||||||
|
|
||||||
#if defined(WITH_DEBUG_VISUALS)
|
#if defined(WITH_DEBUG_VISUALS)
|
||||||
namespace cloonel {
|
namespace cloonel {
|
||||||
|
@ -80,8 +81,8 @@ namespace cloonel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parLine[0] = static_cast<short2>(line[0]);
|
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] = static_cast<short2>(line[1]);
|
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
|
} //unnamed namespace
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue