Game Development Reference
In-Depth Information
When we place a texture on RectangleShape , it tries to fit into the specified rectangle
by scaling itself up or down. For our example, if the texture has a width of 200, height of
200, and the rectangle is of the size—300 as width and 150 as height, then the texture will
appear stretched on the x axis and squeezed on the y axis:
To set the shape to RectangleShape with the exact size of the texture, we can use a
function from the Texture object— Texture::getSize() :
Here, the result is undistorted:
Search WWH ::

Custom Search