C++ & SDL2 - Big Graphics Bug - Any ideas welcome

Started by
21 comments, last by Nick72c 2 years, 2 months ago

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.

Advertisement

@joej @fleabay

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/

This topic is closed to new replies.

Advertisement