C++ graphic interface frameworks/libraries - c++

I need to program a game, it's a card game actually, and I must make it with graphic interface, but I don´t know about C++ graphic interface libraries.
Is there something for C++ similar to Python's Tkinter or Pygame (I don´t know if there are others).
If there are libs, are they suited for building a simple card game?

The most common cross-platform GUI toolkit is Qt, I'd go with that for any C++ GUI application. Especially easy on Linux, all distros have packages for it, but Windows has binary installers too for different compilers.
You can use Netbeans, but I'd really go with Qt Creator for Qt programming.
For a card game with Qt, QGraphicsView is probably easiest, if you want animated card movement etc. For a more static UI, QWidget based one would be very easy. For a modern visually rich UI, QML (but then GUI part is not C++) would work very well.
Achilles heel of Qt for game development is real-time game sound effects, but you can mix Windows-specific sound stuff easily if you do not care about cross platform stuff, and card games don't need much there anyway, if anything. Also, I think Qt5 may actually have improvements for sound, making pure Qt good enough for games.

If it is a game, you may consider SDL
Fun fact: pygame is backed by SDL.
BTW, if you want to have GUI controls in your game( http://www.tayloredge.com/utilities/vbapps/gui.GIF ) , you will need a GUI library. Otherwise, a game library, like SDL, is more suitable for you.

Related

Is QML the way to go if designing a game in Qt?

Was looking into making a game with Qt and was wondering if QML has gotten to the point yet where it could be used as a serious tool on the desktop. Have seen some post from Qt stating that they will be transitioning most things to QML eventually, so this seems like it may be the way to go, at least according to Qt.
Edit: I realize that QML probably wouldn't be the best bet for a 3D game with heavy graphics. Was looking more for something that did mostly 2D stuff like a platformer type game.
Seen this http://labs.qt.nokia.com/2010/08/12/a-guide-to-writing-games-with-qml/. So its obviously possible to some extent. I have also seen some impressive games made solely with java script, which I believe is the base of QML. I was just curious as to what would be the best way to go with Qt at the moment since things have been changing lately...
It may depend on "how long" you want to wait before releasing your game.
The Trolls/Qt are re-doing its "graphics stack" right now: Rather than historic "every-widget-renders-itself" (which is the wrong paradigm for games and rich mobile apps), they are re-implementing to a single graphics stack that renders the WHOLE interface, where the "widgets" themselves are mere data-sets that feed into the rendering. In short, the goal is to make desktop/mobile applications with the exact same performance as the high-end games have done for decades (with their own graphics stack that looks nothing like the typical X/Xlib/Motif/Xvt/Win/MFC/Qt applications graphics stack). Further, the Qt5 plans (in planning/development now, they claim a release sometime next year) are reliant upon OpenGL for this graphics stack implementation.
After this work, the pipeline will be: Widgets==>QML==>(C++ Graphics Stack)==>Hardware. Currently (Qt 4 and previous) it is: QML==>Widgets==>(C++ Graphics Stack)==>Hardware.
You can google for various posts/discussions on this, or here's a long-ish presentation that talks about these efforts: http://qt.nokia.com/developer/learning/online/talks/developerdays2010/tech-talks/performance-do-graphics-the-right-way/
IMHO, QML makes more sense for games, since the interface components are "independent actors" (e.g., not tied to each other through layouts). That's also why QML makes so much more sense for mobile (where real estate is a premium), and for very flashy desktop apps (although it is still relatively young and unproven for that).
QML already has lots of rendering/animation options, but they are mostly a very rich 2D (but with which you could simulate 3D pretty well). The QML 3D is undergoing heavy revision right now, but the new stuff looks really good (and sits on OpenGL). So, if you want heavy 3D, it might be experimentation time for the moment, until you see the new Qt5 interfaces and can take advantage of the hardware acceleration (depending on how much 3D you need).
The performance specs I've seen from the new Qt5 stuff with the new graphics stack (in prototype development) are quite impressive, so much so that I've been thinking about writing some games in QML just to play with it. If this were twelve-months-from-now (or so, after the release of Qt5), I'd bet QML would be the best/easiest decision for games (because the components are independent actors, it's so simple to use, and I'd push all the game-specific heavy stuff into C++, which is really easy to do with QML on top).
QML is definitely a viable option for designing 2D games and can save you a lot of time and lines of code.
V-Play (v-play.net) is a cross platform 2D 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).
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
Remember that QML is only designed to lay out the UI. Fundamentally, it acts as a QGraphicsView with lots of utility functions (code in QML is at least three times shorter than the Qt/C++ equivalent, at least, that's how I felt it)
The core of the application is still handled by either javascript files (if things are not too complex) or C++/Qt files (if you want the full extent of Qt possibilities)
As Jeremy Salwen said, for a game that looks like a smartphone app game (big sprites that move with nice transitions, with simple logic behind it), then QML is more than sufficient.
But if you want something complex, then you will end up using in QML only QDeclarativeItem classes that you will have previously defined in C++. Not that useful.

What is most commonly used as a window manager for OpenGL nowadays?

Glut seems rather old, and SDL also as if it's not the youngest anymore - what is being used as (cross-platform) window manager for OpenGL nowadays?
Cross platform UI toolkit
1. wxwidgets
2. fltk
3. qt
4. glut(freeglut)
5. sdl
I have used glui. Sucks real bad(in terms of performance). There huge difference in performance penalty just by including glui(without actually using it) in your apps.
To be honest, i prefer platform specific UI toolkit. Faster. Reliable.
Depends on how you want to use it. Don't think there is a clear winner.
I like to use Qt because I'm familiar with it so it feels easy to me, and because I use it for other UI elements in my mostly windowed openGL apps.
Haven't tried it myself, yet, but want to in my next project. It seems to be very popular.
SFML . It`s the "successor" to SDL written in C++
I am using freeglut, but it is just a bit improved glut.
You can also use QT
I think GLFW is the best choice for small to medium applications/games. This type of libraries should be easy,small and fast with no extra services such as image helper functions and so on. GLFW is going to remove all helper functions to focus on the main goal.
QT is the best for graphics applications but not for games or small applications.

C++ OpenGL Window Kit

Besides Qt, GTK, wxWidgets... What are the recommendations for a cross platform, open source GUI framework library that works with OpenGL?
Its not quite a GUI framework. But GLFW is good for an OpenGL window with some extra features like keyboard and joystick handling.
I found the other framework I was looking for. It is SFML. I only used it briefly but I do remember liking it very much. It does contain a lot of nice extras going a step further than GLFW. If I recall correctly the documentation was stellar.
For a full featured cross-platform GUI framework I think you would be hard pressed to beat QT, GTK, or wx.
I'm not sure, but at a guess, the other framework mfperzel was trying to think of might have been fltk (the "fast light tool kit"). Where glfw is mostly an OpenGL window with some ability to read the mouse and keyboard, fltk is a GUI framework that supports OpenGL (but as the name implies it's still quite a bit smaller and faster than most GUI frameworks). I haven't tried it yet, but there's a new GUI builder program for it (FLUID) that looks fairly promising as well. One warning though: FLTK uses its own widgets, which tend to look at least a little foreign to most users.

What library to choose to build a user interface for a C++ software that uses SDL

I have a simulation software (C++) that runs on the command line. It is platform independent (currently compiling and running on Windows, MacOS X and Linux). When the simulation ends, I visualize the result with SDL; it is a very basic 2d view, mainly color squares next to each other.
I would like to have a user interface on top of the simulation so that I can start and pause the simulation, and change the parameters on the fly. Something pretty simple I guess. Well, ideally I will also add a grapher somewhere to see the evolution over time of some parameters.
Now, I am wondering what direction I should go.
Should I try to use one of the UI libraries for SDL ?
Or maybe wxwidget in conjunction with SDL ?
Or simply wxwidget and get rid of SDL ?
Do you have any experience with this ?
Thanks in advance
Barth
PS: I tried to use AGAR, a SDL UI library. It seemed very promising but I couldn't get it working. Not even the helloworld.
It may be worth you time to look into Qt. It is generally the most mature free Gui framework available. It is cross platform. And it has hardware accelerated rendering if your drawing needs some speed.
Here is a comparison posted on WxWidgets site.
In the end if your windowing needs are minimal you should choose the framework you are most comfortable with.
Probably using wxWidgets without SDL would be the easiest way to go. SDL is a media layer -- it's supposed to allow cross-platform media application development. As you only need graphical display, you only need wxWidgets -- and it will be a lot easier too!
You would benefit from SDL if:
you'd need very fast blitting of very large amount of surfaces (we're talking the 60fps range here)
you'd use RLE, color keying or other graphics operations
you'd use other media (sound, advanced real-time input, etc)
you'd need to run the software on embedded systems (handheld consoles, etc)
If the answer to all 4 is "no", then you won't benefit from SDL, and using wx alone will be much easier.

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 ?
The Animation Framework
The Graphics View Framework
The Paint System
Qt Declarative
Any help would be appreciated.
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.
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 :)
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.
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.
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
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
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).
A good start would be:
Qt Examples And Tutorials
Perhaps if you need to cheat you may want to look here
xpacman.tar.gz