C++ is one of the most powerful and popular programming languages. Every day hundreds of applications are written on it, often using the GUI. However, working with graphics is not always convenient for the programmer – in this case, ready-made graphic libraries are used. They will make the development of the graphic part of applications as quick and convenient as possible.
SFML (Simple and Fast Multimedia Library) is one of the most convenient and fast graphics libraries for 2D graphics. Its indisputable advantage is the minimum requirements for the level of knowledge of the language and ease of development: in just a few days you can write quite a full-fledged program. For example, the first graphic application “SFML works!” Can be written in just a minute. Another undeniable advantage is cross-platform: SFML runs on Windows, Linux (only X11, but not Wayland) and Mac, and it is planned to launch on Android.
The SFML library is used mostly by small startups and programmers for whom creating games is a hobby. SFML is popular among small teams due to the fact that it does not require writing large amounts of code. You can also complete the initial course.
Qt is a whole set of tools for quick and easy GUI design. Of course, you can write games here too – why not? – but Qt attracts programmers mainly because it is fast, convenient, flexible and cross-platform. In many ways, Qt has overtaken even SFML: the library is available on both Windows, Linux and Mac, and on mobile platforms – Windows Mobile, Android and iOS.
Qt extends C++ using the IOC (Meta-Object Compiler) and provides additional functions (for example, signals and slots). Also has a paid support service (as well as a paid license). For Qt, there is a large selection of IDE: QtDesigner, QtCreator, QDevelop, Edyuk, and integration with Visual Studio, Eclipse and Xcode is also available. You can also complete a full course on this library.
Cairo is a library for drawing vector images under Linux, Windows and Mac OS. For example, such a large project as Mozilla uses Cairo in the browser engine Gecko. Cairo also underlies some operating systems (MorphOS, AmigaOS) and applications (InkScape, Synfig, Graphite).
Cairo can interact with the OpenGL backend with GPU support, which, of course, opens up a whole list of useful features.
Cocos2D-X cross-platform library is designed to simplify the development of mobile games. It supports all the same platforms as Qt. Of the advantages worth noting the availability, ease of use and the creation of a separate game designer, based on the library of Cocos Creator. In the list of games based on the engine, there is the world-famous BADLAND, running on all available platforms.
If you need to work with graphics and animation in large volumes when creating a game, it is better to use Unity instead of Cocos2D-X. Unity has the ability to seamlessly integrate with tools such as Photoshop, Maya or Blender. In Cocos2D-X, all graphics are added from the outside and are referenced from the code.
In English there is an excellent course from the developers.
Juce is a cross-platform framework designed for creating applications and plug-ins in C++.
There is a lot of documentation on Juce, but not in Russian. Therefore, you can download the book “Programming in C++ with JUCE 4.2.x: Creating cross-platform multimedia applications using the JUCE library with simple examples”.
Juce is more popular among audio software developers due to a set of wrapper interfaces for building audio plug-ins.
wxWidgets is one of the oldest, but at the same time the most well-known graphic libraries for drawing GUI. Its main advantage is performance. If QT uses a low-level code only for elements such as buttons and scroll bars, then wxWidgets has its own system for each system, and thanks to this, all elements are displayed as close as possible to the system style.
An important feature of wxWidgets is to use the “native” graphical elements of the operating system interface wherever possible. This is a significant advantage for many users, as they get used to working in a specific environment, and changes to the program interface often cause difficulties in their work.
The web has a lesson on working with the library from its developers.
SDL is a cross-platform 2D library designed for writing applications (mostly games). Windows, Linux, Mac OS, as well as Android, Windows Mobile and iOS are supported. The advantages of the library are speed, reliability and ease of operation. Also in the library are implemented professional tools for working with sound – this is a big plus when developing large projects.
It combines with wxWidgets and integrates well with OpenGL.
GTK+ perhaps one of the most famous graphic libraries. GTK+ is a graphical framework widely used in many systems. Initially, it was conceived as a component of GIMP, but for 20 years after the release of the first stable version, it found application in hundreds of other applications.
Now GTK+ is a full-fledged graphical framework, not inferior to the same QT. It supports various programming languages and continues to evolve.
At one time, the library was created as an alternative to Qt, which was paid. GTK+ is one of the few frameworks that support the C language. The library is cross-platform, but there is an opinion that programs on Linux look more native than on Windows or Mac (GTK+ is well supported even on KDE). Interestingly, due to some cross-platform issues, Wireshark has moved to Qt.
The above are the most popular technologies for working with GUIs, not only in C++, but sometimes in other languages (for example, Qt and GTK+). However, you should always take into account the features of a technology. Write down the list of functions of your application, once again read the descriptions of all libraries and frameworks, and only after that choose what is really best for the project.
You can comment on the article below or ask a question on Uzabila QNA.