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

Author Topic: Window only updates when mouse is moved over it.  (Read 4193 times)

0 Members and 1 Guest are viewing this topic.

Rubenknex

  • Newbie
  • *
  • Posts: 21
    • View Profile
Window only updates when mouse is moved over it.
« on: April 16, 2011, 10:52:28 am »
I just switched to Ubuntu and tried using SFML, however my RenderWindow only updates when I move the mouse cursor over it.

I use the code from the tutorial about Sprites and move the sprite by a tiny amount each frame. If I move the mouse for a few seconds the window keeps updating after I stop moving it, but after a few seconds the window stops updating.

Code: [Select]

#include <SFML/Graphics.hpp>
 
 int main()
 {
     sf::RenderWindow App(sf::VideoMode(800, 600), "SFML window");

     sf::Image Image;
     Image.LoadFromFile("data/circle.png");
     sf::Sprite Sprite(Image);

     while (App.IsOpened())
     {
         sf::Event event;
         while (App.GetEvent(event))
         {
             if (event.Type == sf::Event::Closed)
                 App.Close();
         }

         sprite.Move(20 * App.GetFrameTime(), 0);
 
         // Clear screen
         App.Clear();
 
         App.Draw(sprite);
 
         // Update the window
         App.Display();
     }
 
     return 0;
 }

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Window only updates when mouse is moved over it.
« Reply #1 on: April 16, 2011, 10:57:57 am »
Are you using a compositor window manager such as Compiz?
Laurent Gomila - SFML developer

Rubenknex

  • Newbie
  • *
  • Posts: 21
    • View Profile
Window only updates when mouse is moved over it.
« Reply #2 on: April 16, 2011, 11:43:00 am »
I think I'm using metacity with compositing enabled, but I'm not too sure as I've just started using Ubuntu.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Window only updates when mouse is moved over it.
« Reply #3 on: April 16, 2011, 05:12:24 pm »
You should try to disable it (if you find how to) and see if it still happens.
Laurent Gomila - SFML developer

Rubenknex

  • Newbie
  • *
  • Posts: 21
    • View Profile
Window only updates when mouse is moved over it.
« Reply #4 on: April 23, 2011, 09:52:40 pm »
I succeeded in disabling compositing and the problem still remains  :(.

Rubenknex

  • Newbie
  • *
  • Posts: 21
    • View Profile
Window only updates when mouse is moved over it.
« Reply #5 on: April 23, 2011, 10:12:16 pm »
Never mind... I made a stupid mistake, I quickly wrote the event loop and never looked at it again, but I accidentally included the updating and rendering inside it. I feel stupid  :x.