Hi!
I have a class like:
someclass name{
public:
sf::Texture sometexture;
sf::Sprite somesprite;
void settexture(){
somesprite.settexture(sometexture);
}
void loadtxt(std::string path){
sometexture.loadfromfile(path);
}
};
and then somewhere in code i have;
std::vector <name> arrayofclasses;
...
arrayofclasses[i].loadtxt("Files/file.bmp");
arrayofclasses[i].settexture();
and i get compiler error:
'void sf::Shape::setTexture(const sf::Texture *,bool)': cannot convert argument 1 from 'sf::Texture' to 'const sf::Texture *'
ofc the code up there is just sample i wanted to explain what i have in a simple way, but it looks like this: array of classes, in one of them i want to set texture and then load them to sprite.
im using visual studio
why does it happen?
what is wrong?
would appreciate any help :)
I want to print all images from a folder.
I read it all with a function that is not really important in this problem imo
I have something like
image.gif
image2.gif
etc etc
so then i create as many objects of a class that looks similar to the one i posted before, as many images there are
then in a loop i set the parameters of the somesprite like size etc.
and then i use the loadtxt function, to load the sprite with texture
then there is a piece of unrelated code
at the end of program i display all of loaded images in positions set before in a loop
all loops mentioned above display the images depending on the count of the images gathered at the loading process, so the display looks something like
window display someclass[i].somesprite
where i is the counter that counts towards the number of all images
i hope the explanation is clear, if it is not ill just post code here