2
votes

Has any of you guys ever tried writing a 2d game in C++ using Qt's QGraphicsScene/QGraphicsView classes for the purpose of rendering and collision detection? Do they perform well if there are many moving/animated objects on the scene? Are there any caveats? In general, can you point me to any games written using Qt's graphics facilities?

Thanks in advance.

2
I haven't tried it, but one caveat I can offer is that the framework doesn't do z-buffering - so unless you have very few objects you'll probably want to roll your own.ctd
Have a look at KDE Games games.kde.org. Many (most?) of them are based on graphicsview these days.Frank Osterfeld

2 Answers

0
votes

I tried to use them for rendering. They don't perform very well, besides Qt itself is not very adapt for a game: they're a pretty heavy library doing lots of stuff. Their event handling is not lightweight.

If it's a simple game you should be ok; that API is really easy to use and can be set to use OpenGL or software rendering with just a flag. But if you want to write a real game you should opt for something else, something thought for games.

0
votes

I don't think using qt is an optimal solution any way it can be done even without the graphicsviewframework like this tutorial about creating a breakout game:

http://www.zetcode.com/gui/qt4/breakoutgame/

Anyway my suggestion is to use another library may be sfml or SDL or may be you can try the new polycode engine

http://www.polycode.org

It looks very promising.