And Happy New Year
|
Last time I wrote something here I was having issues with what I thought was a memory leak, so this week I decided to take the chance while home in Stockholm and asked my father for assistance. To debug we went through the existing code, seeking through it piece by piece until we found where exactly everything broke. After having traced the code back through the DrawManager we realized that m_sprite, the intended source of the sprite, was for some reason empty, and thus just pointed at random places in memory where it was luckily not allowed access. Now having an idea of where the issue lay, I glanced through my GameState.cpp file and noticed a piece of code saying: Sprite* sprite = m_systems.sprite_manager->CreateSprite(”../assets/Blocks.bmp”, 40, 0, 40, 40); Which seemed odd, since sprite was not used anywhere. Then it hit me and I changed the code to: m_sprite = m_systems.sprite_manager->CreateSprite(”../assets/Blocks.bmp”, 40, 0, 40, 40); This did solve the issues and allowed the program to start without sudden breaks. Since then I have been able to go on and will now only have to solve the new issue related to SDLKey refusing to have anything to do with the keyboard. Hopefully that will go a bit quicker. /Stefan |