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

Author Topic: fullscreen mode and breakpoints in Visual studio 2012  (Read 2927 times)

0 Members and 1 Guest are viewing this topic.

starkhorn

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • Email
fullscreen mode and breakpoints in Visual studio 2012
« on: January 14, 2015, 07:50:39 am »
Hey Folks,

I'm not entirely sure is a SFML issue or a Windows 7 issue or a Visual studio issue or something else but I'd welcome any thoughts. First I'm using windows 7, sfml2.2 and visual studio2012.

So I use a very basic program - infact I use the example code in the "SFML and Visual studio" getting started tutorial. (http://www.sfml-dev.org/tutorials/2.2/start-vc.php). However I change the window to full screen mode. I also add an if statement which doesn't do anything except define an int. I put the breakpoint inside this if statement. The purpose was to let the game loop run for a bit before reaching a breakpoint.
(note the below code isn't mine game - however I wanted to use it a demo as this happens even when using a simple sfml program.)


    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!", sf::Style::Fullscreen);
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

        int count = 0;
        while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(shape);
        window.display();
                count++;

                if (count == 666)
                {
                        int test = 0;  //<-------- I add a break-point here in VS2012.
                }
    }

 

- So when count == 666, then the breakpoint gets hit.
- When I do not use fullscreen mode, it automatically goes back to the VS window and to the exact break-point.
- However when I do use fullscreen mode (as above), the sfml window always remains as the only visible item on screen and the VS studio does not appear.
- However I do think the focus has switched to another window as if I pressed alt+f4, then the VS studio window gets closed. However I only see this after I get back to the windows7 desktop. It is impossible to know for sure as the fullscreen sfml window is all that is visible.
- I have to ctrl + alt + del -> cancel and then I can see the VS studio window and the windows7 desktop screen.

So my questions are:-

- Is this normal behaviour?
- Can it be changed somehow as I find it makes it more troublesome when debugging my program to have to do ctrl +alt + del each time there is a break-point.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: fullscreen mode and breakpoints in Visual studio 2012
« Reply #1 on: January 14, 2015, 09:42:01 am »
Well if you have a good enough PC your framerate can be well above 1000 FPS with such a simple application, so your counter will hit 666 within under a second.

Now debugging in fullscreen is always a bit a pain, which is why on a professional level ond often uses a remote machine for debugging.
I'm not sure if the SFML window should drop into the background. Question is: Why can't you work in window mode?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

BlueCobold

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: fullscreen mode and breakpoints in Visual studio 2012
« Reply #2 on: January 14, 2015, 07:25:40 pm »
From my experience on windows, this issue is not related to SFML and debugging fullscreen-apps always acts like that. Multi-screen-setup or remote-debugging is the only way to avoid this.

starkhorn

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • Email
Re: fullscreen mode and breakpoints in Visual studio 2012
« Reply #3 on: January 16, 2015, 07:14:35 pm »
Ok thank you folks. As I'm still very new to programming and debugging, then I guess I wanted reassurance this wasn't caused by anything that I was doing incorrectly.

Yeah I can debug with a window as the same size as the full-screen, I just thought it would be nicer to see the game in full-screen. However no drama, I'm just relieved this is normal and nothing that I am doing incorrectly.

Many thanks.