1
Window / Re: Class for multi-layer sprites rendering
« on: July 10, 2024, 09:27:35 pm »
You'll need to make sure that all of the pointers are valid. That is, both 'not null' and 'of type sf::Drawable*'.
Presuming your using my exact code, is it crashing on where I wrote "i expect this to work"?
Thinking about it, I think I used the wrong cast. It should not be "reinterpret_cast", it should instead be "dynamic_cast". I'll edit my post.
I've also realised that that loop doesn't need to be a reference. i.e. "const auto t" instead of "const auto& t" since it's just a pointer and a reference to a pointer seems to make little sense (unless in very specific scenario).
Presuming your using my exact code, is it crashing on where I wrote "i expect this to work"?
Thinking about it, I think I used the wrong cast. It should not be "reinterpret_cast", it should instead be "dynamic_cast". I'll edit my post.
I've also realised that that loop doesn't need to be a reference. i.e. "const auto t" instead of "const auto& t" since it's just a pointer and a reference to a pointer seems to make little sense (unless in very specific scenario).