SFML community forums

Help => Graphics => Topic started by: Sklfl on August 17, 2022, 01:47:41 pm

Title: Graphics, double massive, matrix
Post by: Sklfl on August 17, 2022, 01:47:41 pm
Hi guys!
I would like to create a matrix having a size for example [10][10] and consist of the drawn squares. How to make and output it on the screen not only a line, but also a matrix?

P. S. I know English poorly. Sorry)
Title: Re: Graphics, double massive, matrix
Post by: eXpl0it3r on August 18, 2022, 03:22:53 am
Depends on what the matrix contains/represents.
Is it some numbers or some tiles or something else?
Title: Re: Graphics, double massive, matrix
Post by: Sklfl on August 18, 2022, 08:45:18 am
There will be objects of the CircleShape class
Title: Re: Graphics, double massive, matrix
Post by: eXpl0it3r on August 20, 2022, 04:25:20 am
I personally suggest to represent the matrix in a 1D space by calculating the necessary offset, if you don't want to do that, you can use std::vector<std::vector<sf::CircleShape>>> and then initialize it correctly.
For drawing it to the window, you'll just need to loop over both dimensions and call window.draw()