1
General / mapPixelToCoords returns
« on: December 02, 2013, 06:08:34 pm »
I dont understand why does mapPixelToCoords take in a an integer and returns a float, whereas mapCoordstoPixel takes in a float and returns an interger?
The part i am having a problem with is:
Quote
Vector2f mapPixelToCoords (const Vector2i &point) const
Convert a point from target coordinates to world coordinates, using the current view.
Vector2f mapPixelToCoords (const Vector2i &point, const View &view) const
Convert a point from target coordinates to world coordinates.
Vector2i mapCoordsToPixel (const Vector2f &point) const
Convert a point from world coordinates to target coordinates, using the current view.
Vector2i mapCoordsToPixel (const Vector2f &point, const View &view) const
Convert a point from world coordinates to target coordinates.
The part i am having a problem with is:
sf::Vector2f mouse = window.mapPixelToCoords(sf::Vector2i(event.mouseMove.x, event.mouseMove.y));
pixel to coords takes in an int,and returns a float...However floats are not needed. So i would rather return an integer for mouse, but yet cannot because pixels to coords must return of type Vector2f. That or have pixel to coords take in mouse as a float, but that it not possible as well. So how can i get nice flow of only integers or only floats without switching between the two?