I'm rather new, so please spare me if I am wrong, but I believe that there may be some sort of implicit type conversions going on. I have no idea what type your hero_position_x is, but the
getSize().x
returns a value with a type of template parameter T, which can be either int or float, though I do not know whether it is unsigned, thus the
(p.hero_position_x+50-(*window).getSize().x/2)
might not be an integer until you declare it as an integer in dx.