SFML community forums

General => SFML wiki => Topic started by: sb on July 15, 2016, 09:15:35 pm

Title: Tutorial: Integrating SFML into Qt: FrameTime = 0
Post by: sb on July 15, 2016, 09:15:35 pm
Hi there.

Regarding https://github.com/SFML/SFML/wiki/Tutorial%3A-Integrating-SFML-into-Qt , I think one could suggest changing the constructor
QSFMLCanvas(QWidget* Parent, const QPoint& Position, const QSize& Size, unsigned int FrameTime = 0);
such that default value is
unsigned int FrameTime = 1000/frames_per_second
or something alike.

The reason is that with a zero FrameTime, at least in my case (Windows 7), the program uses a whole lot of CPU time without actually doing anything. Changing it to a value like 1000/60 drastically reduces the CPU usage, and 60fps should be really enough for drawing in a GUI.

If you agree, you could update the tutorial (I won't as I don't want to register there), however, if my suggestion is not reasonable, please explain.
Title: Re: Tutorial: Integrating SFML into Qt: FrameTime = 0
Post by: korczurekk on July 31, 2016, 08:59:55 pm
It is already done in my QSFML library, you can use it to integrate Qt & SFML instead of implementing it on your own. I used 7 miliseconds, which gives ~144fps.
You may have good point, but example pure-SFML apps also don't use fps limit, sooo... I'm not sure what others think about it.