SFML community forums
Help => Graphics => Topic started by: Zeus-Ammon on September 27, 2019, 04:25:33 pm
-
Hi. I have recently started playing around with SFML and have come across a strange problem.
I am creating a Tile Map implementation and the texture I'm using for the tiles is a 64*64 png but when it comes time to draw the sprites they seem to be stretched in the X axis to what appears to be exactly double the size (128*64).
I have no idea why this is happening. I load the tile texture from the file directly and I have checked that it loads with the correct size. When I create the sprites I use the constructor that receives a Texture which is my understanding that it creates the sprite such that it displays the texture in its original size. Then I simply move the sprite to its correct position (using move function).
EDIT:
To clarify even simply creating a sprite with said 64*64 texture and drawing it on screen still reproduces these results independently of any of my Tile Map implementation code being run.
To the effect of:
sf::RenderWindow window(sf::ViewMode(1920,1080), "Title", sf::Style::Fullscreen);
sf::Texture t;
t.loadfromfile("path");
sf::Sprite s( t );
// Somewhere in render loop
window.draw(t);
Any help would be appreciated.
Thanks in advance.
-
If you run the SFML examples do they look similarly stretched? If not, can you provide a complete but minimal example?
-
Thanks for your concern. It has come to my attention that the View I was using was being instantiated with is default constructor and thus created with a size of 1000*1000 which did not match the window resolution which resulted in the strange effect where displayed textures had different sizes to what I expected. Noob mistake !