2D drawing c++ for grid maze project - c++

I am building a c++ maze project for school and want to create a 2d graphics window in c++ that will let me render something like this http://www.dreamincode.net/forums/uploads/monthly_07_2011/post-114496-13104660729008.png.
Can anyone suggest a 2d graphics library to use? I have looked into openGL but am worried that the geometry necessary is too complicated for what I need. Of course I may be overlooking some things.
I am working in Xcode on OS X and if the library is not multiplatform that is okay. Can anyone suggest me something?

The Qt framework is a cross-platform solution for building applications.
There is a basic drawing example that shows how to use basic graphic primitives:
The core of the technique consists in reimplementing a widget's paintEvent() method to control how it is displayed (painted) on the screen. The QPainter class provides many drawing methods to suit your needs.

Since cross-platform is not a problem, just use Quartz or SpriteKit. Quartz is general 2D drawing, SpriteKit is specifically for games. All the docs you can access directly in Xcode through the documentation window, and Apple provides a bunch of sample code too.

Related

Which graphics technology does Qt uses to render its custom UI?

I inspected the Qt GUI interfaces using window spy tools and I know that it does not use windows common controls or any custom window class to create its UI elements and animation effects. I asked before here about developing a custom GUI framework using GDI/GDI+ but most people responded against these technologies, so the question remains which graphics technology Qt or any other equivalent appropriator system uses to render their UI?
I am aware of DirectX/OpenGL but isn't it overkill for simple requirements? If the answer is going to be one of the above then again I wonder how one could implement robust font rendering and vector graphics solutions with these polygon rendering technology? the full featured text editor is another huge challenge.
Also there already exists solutions based on directx/opengl like MyGUI and CEGUI but I think they look ugly and nowhere near how Qt looks.
First things first, Qt-5 introduced a new rendering model, which can (but is not required to) use OpenGL for rendering the UI elements. The upshot of this is, that one can truly mix custom OpenGL rendering with Qt widgets. The downside is, that some kind of OpenGL support is required, which not all systems have.
So Qt also has these two other drawing systems: Native, which will use the hosts systems native graphics primitives (GDI, CoreGraphics, X11/XRender) and raster which does a complete rasterization of a whole window into pixel buffers, where then only those are blitted over to the underlying graphics system. raster is the slowest of the graphics backends, but it gives consistent results for all plattforms and target systems. Hence raster is usually used for programs where consistent appearance is strictly required.

cross platform C++ library/libraries to: display a window, render 2D shapes on the screen, render text on the screen

Can anyone recommend a set of C++ libraries to do the above? I've tried several things and have had problems with all of them, but rather than going into it all, I'm more interested in an unbiased recommendation on some good technologies for this. I'd give preference to simplicity over performance, in general.
How about Qt and it's QGLWidget ?
OpenGL for graphics, U++ for GUI
You may also consider looking wxWidget + OpenGL

Need cross-platform GUI toolkit with OpenGL support

I need a cross-platform GUI toolkit with OpenGL support. I also need to be able to draw on a canvas or panel from an image buffer. The candidates I've chosen so far are FLTK (it can do OpenGL windows -- I don't know about canvases), Qt, and wxWidgets.
Any idea which would be the best?
Thanks!
I would say Qt. But that might be argumentative question...
Hey Deep, XVT support openGL. It's a GUI cross-platform toolkit for C and C++ www.xvt.com
For simple things I would suggest GLUT or something similar. But for anything above a simple window into which you render some OpenGL, I strongly recommend Qt. But as tibur said, its probably a matter of taste.
Checkout the Ecere SDK. It's a feature rich cross-platform GUI toolkit, and it supports a variety of graphics driver (e.g. GDI, X11, OpenGL, Direct3D). It has a built-in 3D engine, but you can mix it with your own OpenGL code as well, there are samples showing you how to do just that. It was originally designed as a GUI system for in-game menus, so it supports full screen mdoe as well as windowed mode, but is now a general purpose SDK.

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 using 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.

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