Qt library for developing 2D / 3D games

As a hobby, I worked on remaking an old video game, and I want to avoid the opportunity to reinvent the wheel where possible. The game is largely based on a graphical interface, but the graphical interface must be customized in terms of appearance, and it must also work with 3D OpenGL rendering for multiple game screens.

To give you an idea, here is a screenshot from the original prototype:

enter image description here

There is a lot of animation, as well as 3D, but GUI widgets behave the same as in a standard desktop application.

So far, I have used my own graphics library (it was not reliable or complete, and I had some problems).

I am considering switching to Qt, given its reputation and impressive features, as well as some of the good screenshots on the Qt website. But I had never used Qt before, so I have no idea what it is capable of, or what time it will take to learn. (Note. I used FLTK).

My question is: would it be possible / practical to use Qt in this situation?

UPDATE : after mocking some game screens in Qt, I decided not to use it. Although it supports many of the features that I need out of the box (especially through style sheets), I need to support custom pre-processed fonts based on bitmaps (I can't convert or replace them). And I cannot subclass QFont or redefine it without hacking it in future releases of Qt. However, I was very impressed with Qt (both in ease of use and in good documentation). I will borrow some of its features for my own engine. Thanks to everyone who provided the information.

+6
source share
2 answers

It is hard to know everything you need to do based on the screenshot; however, I will respond to the moods of other posters and provide you with several options.

Firstly, you can consider QtQuick over the GraphicsView Framework, but it REALLY depends on what you need to do. I just want to throw it away as an alternative so you don't miss it. This tutorial uses QtQuick to put together a really smooth looking game for four styles. It may be more simplified than what you want, but then again, maybe it is not, it depends on what you need to do.

Secondly, before writing custom paint events for all of your buttons, I would consider using Qt Style Sheets and the style of your widgets in CSS, such as syntax. This will allow you to very quickly and easily change the look of your GUI. Based on your screenshot, I think you can get what you want from style sheets much faster than subclasses and scroll through your own customization. But once again, this is hard to understand based on a single screenshot. Here is an example of a dark and orange GUI that was implemented using only Qt style sheets. The border-radius property of the QPushButton will give you rounded buttons ( ref ).

+4
source

The simple answer was given above, but to throw a few more thoughts: yes, you probably will not have to fight too much with Qt. For the most part, the recommended tip for working with similar widgets like this is a subclass and itself implements a drawing event.

You can then use the loading of basic drawing primitives to get basic shapes for elements and expand from there. In fact, you have a few questions with really good resources on how to do this.

+1
source

Source: https://habr.com/ru/post/917350/


All Articles