New to QT - Where should I start with this gaming idea?
I'm in an Introduction to C++ course at my college and my group (four people) is beginning a final project due in several weeks. The project is a clone of the classic arcade game Bomberman (if you're not familiar with Bomberman, then feel free to pretend the rest of the question is talking about Pac-man---both are real-time 2D games with characters moving about on a 2D grid).
I understand that learning QT in two weeks between four people is a lofty goal, but our professor is expecting the same of our group and many others. Anyways, after several days of treading water and getting nowhere, I'm wondering if anyone can help me get started. I'm finding Qt very complicated, especially since I wrote my first line of code in C++ less then 3 months ago.
First, I understand there is something called the Graphics View framework. Would this be the framework we build our project in? Again, it will be a 2D grid for a real-time, Pacman-like game. If so, should we be using QGraphicsGridLayout, or QGraphicsLayout? Are there any other classes or whatever that we should be expecting to use?
Also, is there a really good introductory video or article that explains the basics of programming in Qt? I hope to come back and learn the ins and outs of Qt, but for now I'm especially looking for stuff that will let me starting programming today---even if my theoretical understanding is a bit shallow.
I recognize that there is a game development subforum, but given the extremely basic question that I'm looking to answer, plus my request for introductory material in the previous paragraph, I though the General subforum might be better.
Hi, and welcome to the Qt Dev Net!
[quote]I’m finding Qt very complicated, especially since I wrote my first line of code in C++ less then 3 months ago.[/quote]Qt is a very large framework which does lots of different things (most of which you wouldn't need). It's best to learn the basics, and then focus on learning the parts that you need.
[quote]First, I understand there is something called the Graphics View framework. Would this be the framework we build our project in?[/quote]The Graphics View framework is actually and old technology which has been replaced by "Qt Quick":http://qt-project.org/doc/qt-5/qtquick-index.html. However, Qt Quick uses the QML language -- if your course restricts you to the C++ language only, then yes Graphics View is the way to go.
Here is an introductory video to the Graphics View framework: https://www.youtube.com/watch?v=P9VG5LpU1lA
[quote] it will be a 2D grid for a real-time, Pacman-like game. If so, should we be using QGraphicsGridLayout, or QGraphicsLayout? Are there any other classes or whatever that we should be expecting to use?[/quote]I'm not very familiar with the Graphics View framework myself, so I'll let others answer your question about layouts. However, you can find a good overview, as well as a list of classes, at http://qt-project.org/doc/qt-5/graphicsview.html
See also http://qt-project.org/doc/qt-5/examples-graphicsview.html for example code
qxoz last edited by
Hi Maps. Welcome to DevNet.
Optimal solution for this kind problem would be a QML.
"Qt Quick Code Samples":https://qt-project.org/doc/qt-5/qtquick-codesamples.html (there are few game examples)
But as i understand you need C++ solution, then take a look to:
"Graphics View Examples":https://qt-project.org/doc/qt-5/examples-graphicsview.html (probably Colliding Mice Example could be a start point)
Thank you both for your responses!
I don't believe we are restricted to using C++, so let's say that Qt Quick is an option. Would it be worth using Qt Quick, or should we stick to Graphics View because it is only C++? Would learning enough QML to build our game in Qt Quick be worth it?
What is the difference between Qt Quick and Qt Widget? Which is better for our game?
Is the only difference between Qt Quick and Qt Widget that Widget uses C++?
If Qt Quick is an option, take it. :)
The language used is not the only difference. Qt Widgets were designed long ago, for traditional desktop-style office applications (imagine Microsoft Word 2003). Qt Quick was designed specifically for things like games, which use animations, sprites, sound effects, etc. The Graphics View framework sits somewhere between Qt Widgets and Qt Quick.
It is possible to write games with Graphics View, but Qt Quick would make your life much much easier.
To learn Qt Quick, see the "simple tutorial":http://qt-project.org/doc/qt-5/qml-tutorial.html and then the "advanced tutorial":http://qt-project.org/doc/qt-5/qml-advtutorial.html