I've recently started learning SFML. Unfortunately, whenever my "game" ends, the program crashes. I've linked this to my Game deconstructor (and discovered that in general, whenever a Food object, dynamically allocated or not, is deleted, the program crashes). The game will hopefully evolve into, at least an attempt at Snake. So if you understand why it's crashing, well I would greatly appreciate some advice, thanks!
main.cpp
1 2 3 4 5 6 7 8 9 10 11
#include <cstdlib>
#include "Game.h"
int main(int argc, char *argv[])
{
Game game;
while (game.Continue()) {
game.Update();
}
return EXIT_SUCCESS;
}
Look at my code... that's exactly what I was doing. I guess I'll try it again not dynamically allocating it, and I'll see if it works better this time :/
EDIT: I forgot to mention that it's the console that crashes after the window closes.
EDIT (again): Wow... I just fixed it by putting an exit(0); in... problem resolved :)