Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- constexpr float thickness = 0.1f;
- horizontalOutlines = std::vector<sf::VertexArray>(width + 1);
- verticalOutlines = std::vector<sf::VertexArray>(height + 1);
- for (std::size_t index = 0; index <= width; index += 1) {
- horizontalOutlines[index] = sf::VertexArray(sf::Quads, 4);
- horizontalOutlines[index][0].position = sf::Vector2f(0.0f - thickness / 2.0f, index - thickness / 2.0f);
- horizontalOutlines[index][1].position = sf::Vector2f(0.0f - thickness / 2.0f, index + thickness / 2.0f);
- horizontalOutlines[index][2].position = sf::Vector2f(width + thickness / 2.0f, index + thickness / 2.0f);
- horizontalOutlines[index][3].position = sf::Vector2f(width + thickness / 2.0f, index - thickness / 2.0f);
- for (std::size_t vertex = 0; vertex < 4; vertex += 1) {
- horizontalOutlines[index][vertex].color = sf::Color::Black;
- }
- }
- for (std::size_t index = 0; index <= height; index += 1) {
- verticalOutlines[index] = sf::VertexArray(sf::Quads, 4);
- verticalOutlines[index][0].position = sf::Vector2f(index - thickness / 2.0f, 0.0f - thickness / 2.0f);
- verticalOutlines[index][1].position = sf::Vector2f(index - thickness / 2.0f, height + thickness / 2.0f);
- verticalOutlines[index][2].position = sf::Vector2f(index + thickness / 2.0f, height + thickness / 2.0f);
- verticalOutlines[index][3].position = sf::Vector2f(index + thickness / 2.0f, 0.0f - thickness / 2.0f);
- for (std::size_t vertex = 0; vertex < 4; vertex += 1) {
- verticalOutlines[index][vertex].color = sf::Color::Black;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement