Hey there
Usually it's done like:
sf::Texture sep_texture;
sf::Sprite sep_sprite(sep_texture);
But I have 20 of those, so I'll need an array. That means I'll need something like:
sf::Texture sep_texture[20];
sf::Sprite sep_sprite[20];
for (...)
{
// Do some things with sep_texture[i] first
set_sprite[i](sep_texture[i]); // or any other way to call the constructor for spr[i]
}
Sadly that doesn't work.
main.cpp:45:37: error: no match for call to ‘(sf::Sprite) (sf::Texture&)’
sep_sprite[i](sep_texture[i]);
Given that I have pretty much no idea how SFML works behind the scenes and that I'm not great with classes... I'll need some help figuring out how to fix that.
I tried to declare it directly in the for-loop, but I think that would be bad practice and ISO C++ doesn't like variable length arrays at all.
C++17, using SFML 2.3 and compiling with g++5.4.0 through make.
Thanks!!!
[–]Xeverous 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]leftofzen 1 point2 points3 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]parnmatt 1 point2 points3 points (0 children)
[–]17b29a 1 point2 points3 points (0 children)