the program runs like is should, but when you close it this pops up - Unhandled exception at 0x772115de in Pong 2.exe: 0xC0000005: Access violation reading location 0xfeeefef6.
I think it has to do with these global objects? I'm using SFML 2.
extern std::vector<Tower> Towers;
extern bool clicked;
extern int towerCount;
extern sf::Vector2f CurrentBoxSizeVector;
extern sf::Text BoxCount;
extern sf::Text BoxColor;
extern sf::Text BoxSizeX;
extern sf::Text BoxSizeY;
extern sf::Text ChangeSize;
extern sf::Text PreviewBoxSizeXChange;
extern sf::Text PreviewBoxSizeYChange;
void TowerPushback(sf::RenderWindow& Window);
void TowerDraw(sf::RenderWindow& Window);
void UI(sf::RenderWindow& Window);
void SetSize(sf::RenderWindow& Window);
void SetColor(sf::RenderWindow& Window);
static inline std::string int2Str(int x);
I'll post more if you need more. There's only 3 files to the project.
Thanks a bunch :)!
Last edited on
Can ~Tower() run safely after main has ended? Best is probably to avoid having global variables.
What do you mean run safely after main has ended?
I've heard that I shoudn't, but I don't know why/how I'd do it another way.
Bump please. I don't know how i'd dothis with global variables.
Do not use global SFML objects. It will definitely cause you problems. From what I can see there, it is most likely the sf::Text variables that are the problem.
Last edited on
Maybe if you do post code...
In the meanwhile, show a backtrace.
Thanks, Cire. how would I fix it then?
Show code for what...? If you ask what part I'll give you it. What's a backtrace?