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

Author Topic: Crash after closing rendering window  (Read 1061 times)

0 Members and 2 Guests are viewing this topic.

Alis

  • Newbie
  • *
  • Posts: 1
    • View Profile
Crash after closing rendering window
« on: March 09, 2012, 04:03:00 pm »
Hi :)

Im trying to create a simple 2d game with fullscreen mode. Everything works fine until i close application (under some conditions). System crashes only when i switch my rendering window to fullscreen mode with current resolution settings, using GetDesktopMode. If i work in any windowed mode or in fullscreen mode with diffrent resolution, game quits normally.

Constructor for CProgram, which inherits from sf::RenderingWindow
Code: [Select]
CProgram::CProgram()
{
    Display = sf::VideoMode::GetDesktopMode();
    width = Display.Width;
    height = Display.Height;
    Create(Display, "title", sf::Style::Fullscreen);
    Quit = 0;
    Input = &GetInput();
    //MainLayer = new CMainLayer(width, height, this);
   //ActiveLayer = MainLayer;
}


Here is my main loop:
Code: [Select]
void CProgram::Run()
{
    sf::Event Event;
    while(!Quit)
    {
        while(GetEvent(Event)){}
        if(Input->IsKeyDown(sf::Key::Escape))
            Quit = 1;
        Clear(sf::Color(0, 0, 0));
       // ActiveLayer->DoLogic();
        //ActiveLayer->Draw();
        Display();
    }
    Close();
}


One thing more is, that Application closes fine, if i change GetDesktopMode to GetMode(x), if GetMode(x) != GetDesktopMode.

Im using sfml 1.6 now.

Can anyone say what's the problem here?