Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Graphics, double massive, matrix  (Read 1482 times)

0 Members and 1 Guest are viewing this topic.

Sklfl

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Graphics, double massive, matrix
« 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)
« Last Edit: August 17, 2022, 01:53:46 pm by Sklfl »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Graphics, double massive, matrix
« Reply #1 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?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Sklfl

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: Graphics, double massive, matrix
« Reply #2 on: August 18, 2022, 08:45:18 am »
There will be objects of the CircleShape class
« Last Edit: August 18, 2022, 10:51:08 am by Sklfl »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Graphics, double massive, matrix
« Reply #3 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()
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/