I want to load a texture onto a texture. (before i loaded a image and a image with copy)
or should i can i make image onto a texture ? which is better ?
btw this is my TextureManager.cpp (changed from ImageManager.cpp)
I used to have:
sf::Image tileset;
sf::Image tileImage;
tileImage.Copy(tileset, 0, 0, sf::IntRect(x * tileSize, y * tileSize, frames * tileSize, tileSize), true);
But now i switched my code all to sfml 2.0 and i dont know the function that copies in sfml 2.0.
i want something like this:
sf::Image tileset;
sf::Texture tileTexture;
tileTexture.Copy(tileset, 0, 0, sf::IntRect(x * tileSize, y * tileSize, frames * tileSize, tileSize), true);
edit:I searched a bit, and i think i could use loadFromImage but im not sure how. An example with the code above would be appriciated.
edit2:Maybe this ? but im lacking the 0,0 position, maybe texture.update ?
tileTexture.loadFromImage(tileset, sf::IntRect(x * tileSize, y * tileSize, frames * tileSize, tileSize));
edit3:I managed to fix the errors. Can someone tell if this code does like the past one ?
sf::Image tileset;
sf::Texture tileTexture;
tileTexture.create(tileSize, tileSize);
tileTexture.loadFromImage(tileset, sf::IntRect(x * tileSize, y * tileSize, frames * tileSize, tileSize));
tileTexture.update(tileset, 0, 0);
I have the correct tileSize declaration. i dont get any errors when compile.
ty