Some years ago, during my studies, I took over a student project, written in C++/Qt-3.
It was a simple user interface, whose main part was a simplified soccer field (a bitmap of about 500x300 pixels). Players were also drawn pixel-wise. Well, not pixel by pixel but in bitmap style, somehow.
A robot soccer game was shown with 3 vs. 3 players.
And the whole picture was flickering and awful slow. CPU utilisation was about 95% on an 1.5Ghz machine. Just für six players (shown as coloured circles) and on white filled circle as ball.
I decided to rewrite some code.
QCanvas of Qt3 was the "chosen one" for presenting/drawing the game.
After I did this the CPU utilisation was ridiculous low. Everything went smooth. And it even looked better.
Long story short:
Use QGraphicsScene, which replaces the QCanvas from Qt3 in Qt4.




.
Reply With Quote
(If I draw ~50 000 rectangles, the cpu usage is about 50%)
Bookmarks