Using Qt's QGraphicsScene/QGraphicsView for 2D games
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 usin开发者_JS百科g Qt's graphics facilities?
Thanks in advance.
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.
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.
精彩评论