Are there any 2-D Game Engines for Qt4 out there? I want a game 开发者_如何学JAVAengine that has collision detection, and runs smoothly with lots of sprites on screen.
The QT Graphics view has collision detection build right in. You don't need a framework for that.
"Graphics View provides a surface for managing and interacting with a large number of custom-made 2D graphical items"
V-Play (v-play.net) is a cross-platform game engine based on Qt/QML with many useful V-Play QML game components for handling multiple display resolutions & aspect ratios, animations, particles, physics, multi-touch, gestures, path finding and more. API reference The engine core is written in native C++, combined with the custom renderer, the games reach a solid performance of 60fps across all devices. If you are curious about the games made with V-Play, here is a quick selection of them:
- Squaby: a tower defense game
- Chicken Outbreak: a platformer like Doodle Jump
- Blockoban: puzzle game
- Crazy Elephant: a game similar to Angry Birds
- Snowball Mania: multiplayer action game
- Blitzkopf: brain game
It's not a pure-Qt solution, but Gluon is a game development library based on Qt and some of the KDE game libraries
Pixel level collision detection is not too hard to do in 2D games. First off, create a memory buffer the same size as the display. Then, as each sprite is drawn, draw a monochrome version into the memory buffer where the value written is an ID of some sort. To test for collision, check the (x,y) position in the memory buffer for a non-zero value. The value read is the ID of the object.
QGraphicsView is most likely the best choice if you want to put many items on the canvas. If your game contains not too much objects (say, less than 500), you could also consider QML aka Qt Quick (which will be released with Qt 4.7). Also, QGraphicsView has big support in the Qt developer community, so many components are already available (e.g. in libkdegames).
精彩评论