SFML community forums

Help => Window => Topic started by: PapyRedstone on May 24, 2017, 09:00:15 am

Title: Problem with RenderWindow
Post by: PapyRedstone on May 24, 2017, 09:00:15 am
Hi,
I'm working on a project with some friends using SFML but i'm facing a strange problem i don't understand
Here a link to github https://github.com/PapyRedstone/AIBattleSimulator2000 (https://github.com/PapyRedstone/AIBattleSimulator2000). The problem is on branch detailOfGameImplement.

The problem is in main.cpp(I remove some useless lignes but you can see full code on hiyhub)
Quote
int main() {
  sf::RenderWindow window;
  unsigned currentId = 0;

  Game game;
  window.create(sf::VideoMode(640, 640), "Serveur");

  if (!game.loadFile("ressources/level.txt")) {
    std::cout << "Error loading file" << std::endl;
    return -1;
  }
 
  game.addPlayer(sf::Color::Blue, sf::Vector2f(2, 7));
  game.addPlayer(sf::Color::Red, sf::Vector2f(28, 28));

This code runs the window but create a core dumped when closed

if I call create after  gmae.loadFile the window doesn't launch at all and create a core dumped as well.

I just want to know if you see the problem in my code or if i have to report a bug (or to stop programming  :P)

Thanks in advance
Title: Re: Problem with RenderWindow
Post by: eXpl0it3r on May 24, 2017, 04:53:09 pm
Run it in debug mode through a debugger and get a call stack of the crash.
It's quite likely, that it's an issue in your Game class, but I don't really have the time to do a code review. ;)