I'm lazy and just allocate as many objects as I ever plan on having so the container never gets moved.
.hpp
std::vector<GameObject *> m_objects;
.cpp
m_objects.reserve(256);
I'm lazy and just allocate as many objects as I ever plan on having so the container never gets moved.
.hpp
std::vector<GameObject *> m_objects;
.cpp
m_objects.reserve(256);
🙂🙂🙂🙂🙂<←The tone posse, ready for action.
Thank you both - this has been bugging me (excuse the pun) for days.
Hearing Joe's explanation I was just about to ripe out the vectors and replace them with fixed size arrays, but enemy_image.reserve(20); worked a treat ? thank you!
https://nickchantrell.github.io/Parrallax-Zoom-SDL2/
Download Parallax Zoom!! (pre-alpha) - https://www.gamedev.net/projects/4262-parallax-zoom/