Hello!
I've come a across an issue which I cannot seem to understand.
So I'm creating a header file to handle all my tile creation, which can be passed onto main.cpp to be drawn (sort of). But I'm having some trouble.
tiles.h#pragma once
#include <SFML/Graphics.hpp>
sf::Sprite createWallSide(sf::Vector2f position,int side) {
// Create texture and load image
sf::Texture wallSide_texture;
wallSide_texture.loadFromFile("Tiles/Walls/wallSide.png");
wallSide_texture.setSmooth(false);
// Create sprite and set texture
sf::Sprite wallSide;
wallSide.setTexture(wallSide_texture);
wallSide.setPosition(position);
wallSide.setRotation(90);
switch (side) {
case 0:
wallSide.setScale(5, 5);
break;
case 1:
wallSide.setScale(-5, 5);
break;
};
// Return sprite
return wallSide;
}
main.cppOnly the relevant parts:
Variable declarationsf::Sprite wall = createWallSide(sf::Vector2f(100, 100), 0);
Variable later being drawnwindow.draw(wall);
Now I first suspected it was the image itself, so instead of making it a transparent background, I made it a black background, but it made no difference. So then I thought it was smoothing, and since the image is small, it was maybe being blurred to hell, but
setSmooth made no difference.
Any help is appreciated!