Pym
Pym

Reputation: 1038

Game development with Qt: where to look first?

So, I'm going to develop a Pac-Man clone with Qt. The problem is that I do not really know where to start.

I quickly take a look at the documentation and some demo. I also downloaded some game sources on qt-apps.org. And it seems that there is a lot of ways to develop a game with Qt!

In your experience, which part of Qt should I consider to develop a Pac-Mac clone ?

Any help would be appreciated.

Upvotes: 28

Views: 25670

Answers (8)

stacker
stacker

Reputation: 69002

A good start would be:

Qt Examples And Tutorials

Perhaps if you need to cheat you may want to look here xpacman.tar.gz

Upvotes: 0

Tadeusz A. Kadłubowski
Tadeusz A. Kadłubowski

Reputation: 8363

I think that QGraphicsView framework is the best way. Create a QGraphicsScene, some QGraphicsItems for the elements of the game. You have collision detection for free.

Most of KDE games are based on the QGraphicsView framework. It is a good fit for simple game development.

Upvotes: 17

MeLikeyCode
MeLikeyCode

Reputation: 295

If anyone else is interested in learning how to make GAMES using C++ and Qt, have a look at my YouTube tutorial series. It explains the graphics view framework through a series of videos which build upon a single game that we start in tutorial 1.

C++ Qt Game Tutorial 8 - Adding Graphics

If you are not comfortable with Qt yet, then I REALLY loved VoidRealm's Qt tutorial series, also on youtube (C++ Qt 1 - Introduction to QT programming).

Upvotes: 0

leinir
leinir

Reputation: 932

Well, one place to look could be the Gluon game development framework, which is currently under development. It depends on what you're really aiming for with your PacMan clone, but Gluon may well be what you're after: https://github.com/KDE/gluon

Upvotes: 0

alexleutgoeb
alexleutgoeb

Reputation: 3123

I'm currently working on a project providing gaming-specific Qt Quick Components for cross-platform game development, might be of interest: http://v-play.net :)

Upvotes: 4

Lucas
Lucas

Reputation: 3119

I'm developing a simulation of rigid bodies with Qt and OpenGL using the PhysX API from Nvidia. If you want to see this approach, look at my project at github: http://github.com/lucassimao/Simulacao-Estereologica

Upvotes: 1

Matt
Matt

Reputation: 1242

At the very minimum you will want to look at QGLWidget. You can get an OpenGL program up in a few minutes by deriving from QGLWidget, it will create the window, context, handle mouse and keyboard input, etc. Create a QTimer to trigger updateGL() every 10-15 ms or so and your good to go. I think there is a demo somewhere for setting this up, but it has been awhile since I saw it.

If you want to embed widgets into the window, I would look at QGraphicsView. There is a demo of this called boxes. Just beware the demo is a tad hard to learn from as several classes are thrown into the same file and it might take a few moments of tracing to figure out where the flow is.

Since you are doing a 2d game, you might want to look at using QPainter on top of OpenGL. This allows you to draw primitives easily instead of doing them with OpenGL calls. I never could get this to stop flickering in fullscreen though.

Upvotes: 2

Nikola Kotur
Nikola Kotur

Reputation: 1994

There's a book about game development in Qt here, it's a bit old, but it might give you some ideas. But IMHO, Qt is widget based and is a bit slow for a game, you might consider using SDL or OpenGL.

Upvotes: 1

Related Questions