M
M
Maxim Ivanov2016-04-20 19:42:14
C++ / C#
Maxim Ivanov, 2016-04-20 19:42:14

How to write a game of life in QML?

I don’t know GUI in C ++ at all, so I decided to learn how to work with graphics in QML. There is a task, you need to have a field (how to make them? buttons next to it, a table somehow?) on it, after some time, the contents of these fields will change. Well, that is the classic game of "life". It was possible to make a terminal output, but only writing a graphical interface counts for the top five.
So here's how to create these fields in QML (to duplicate a lot of Rectangle with offsets, or somehow there is an output optimization through a loop, and what can you think of if you only write everything in a .qml file?), And how can these fields recognize the states of their neighbors? The state in the matrix (multidimensional array) is, of course, easy to track in a loop over i and j indices, but I'm not making a terminal conclusion. And I want to do all this through graphic fields (or buttons). In general, tell me where to dig? Thank you.
93acdf494c324372b5fa808d3272e6b6.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tsarevfs, 2016-04-20
@splincodewd

QML is a good thing, but it is not necessary to use it for gui. Perhaps, in order not to dig into qt, it will be easier to use qpainter and draw the cells as rectangles.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question