Untitled
unknown
c_cpp
9 months ago
605 B
0
Indexable
Never
#include "drawMap.h" #include <iostream> void drawMap(sf::RenderWindow& window, std::vector<std::vector<sf::RectangleShape>> shapeMap, sf::View view) { int Top = shapeMap[0][0].getPosition().y; int sizeBlock = shapeMap[0][0].getSize().x; for (int i = abs(Top - (view.getCenter().y - view.getSize().y / 2)) / sizeBlock; i < abs(Top - (view.getCenter().y + view.getSize().y / 2))/ sizeBlock ; i++) { for (int j = (view.getCenter().x - view.getSize().x / 2) / sizeBlock - 1; j < (view.getCenter().x + view.getSize().x / 2) / sizeBlock + 1; j++) { window.draw(shapeMap[i][j]); } } }
Leave a Comment