SFML community forums
Help => General => Topic started by: Rubenknex 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.
#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;
}
-
Are you using a compositor window manager such as Compiz?
-
I think I'm using metacity with compositing enabled, but I'm not too sure as I've just started using Ubuntu.
-
You should try to disable it (if you find how to) and see if it still happens.
-
I succeeded in disabling compositing and the problem still remains :(.
-
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.