Advertisement
Frumkin

Untitled

Sep 11th, 2021
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.62 KB | None | 0 0
  1.     constexpr float thickness = 0.1f;
  2.  
  3.     horizontalOutlines = std::vector<sf::VertexArray>(width + 1);
  4.     verticalOutlines = std::vector<sf::VertexArray>(height + 1);
  5.  
  6.     for (std::size_t index = 0; index <= width; index += 1) {
  7.         horizontalOutlines[index] = sf::VertexArray(sf::Quads, 4);
  8.         horizontalOutlines[index][0].position = sf::Vector2f(0.0f - thickness / 2.0f, index - thickness / 2.0f);
  9.         horizontalOutlines[index][1].position = sf::Vector2f(0.0f - thickness / 2.0f, index + thickness / 2.0f);
  10.         horizontalOutlines[index][2].position = sf::Vector2f(width + thickness / 2.0f, index + thickness / 2.0f);
  11.         horizontalOutlines[index][3].position = sf::Vector2f(width + thickness / 2.0f, index - thickness / 2.0f);
  12.  
  13.         for (std::size_t vertex = 0; vertex < 4; vertex += 1) {
  14.             horizontalOutlines[index][vertex].color = sf::Color::Black;
  15.         }
  16.     }
  17.  
  18.     for (std::size_t index = 0; index <= height; index += 1) {
  19.         verticalOutlines[index] = sf::VertexArray(sf::Quads, 4);
  20.         verticalOutlines[index][0].position = sf::Vector2f(index - thickness / 2.0f, 0.0f - thickness / 2.0f);
  21.         verticalOutlines[index][1].position = sf::Vector2f(index - thickness / 2.0f, height + thickness / 2.0f);
  22.         verticalOutlines[index][2].position = sf::Vector2f(index + thickness / 2.0f, height + thickness / 2.0f);
  23.         verticalOutlines[index][3].position = sf::Vector2f(index + thickness / 2.0f, 0.0f - thickness / 2.0f);
  24.  
  25.         for (std::size_t vertex = 0; vertex < 4; vertex += 1) {
  26.             verticalOutlines[index][vertex].color = sf::Color::Black;
  27.         }
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement