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

Author Topic: Window only updates when I move the cursor over it  (Read 5423 times)

0 Members and 1 Guest are viewing this topic.

Moldytzu

  • Newbie
  • *
  • Posts: 2
    • View Profile
Window only updates when I move the cursor over it
« on: October 09, 2021, 07:45:11 pm »
Hi guys!

I'm a beginner with SFML and I made a basic game. The problem is that window only updates when I move the cursor over it. The code in the main function is

int main()
{
    new (&window) sf::RenderWindow(sf::VideoMode(800, 600), "My ugly game made with SFML");
    sf::Clock clock;
    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        drawEvent();
        window.display();
    }

    return 0;
}
 

And also I'm running Ubuntu 20.04 LTS with Openbox and LXDE.
« Last Edit: October 09, 2021, 08:00:45 pm by Moldytzu »

Moldytzu

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Window only updates when I move the cursor over it
« Reply #1 on: October 09, 2021, 09:17:46 pm »
Fixed. I had to add context settings to the window and then it worked. Strange but it works.

 

anything