Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Problem with RenderWindow  (Read 2197 times)

0 Members and 1 Guest are viewing this topic.

PapyRedstone

  • Newbie
  • *
  • Posts: 1
    • View Profile
Problem with RenderWindow
« 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. 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

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Problem with RenderWindow
« Reply #1 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. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything