I really cant understand why my code doesnt work! Why function Teste doesnt show anything.
#include <SFML/Graphics.hpp>
void teste(sf::RenderWindow &thatwindow);
void DesenhaMapa(sf::RenderWindow &window);
int main()
{
sf::RenderWindow window(sf::VideoMode(600, 700), "SFML works!");
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
teste(window);
//DesenhaMapa(window);
window.clear();
window.display();
}
return 0;
}
void teste(sf::RenderWindow &thatwindow)
{
sf::CircleShape shape(100.f);
shape.setPosition(10, 10);
shape.setFillColor(sf::Color::Green);
thatwindow.draw(shape);
}
void DesenhaMapa(sf::RenderWindow &window)
{
for(int largura = 0;largura<30;largura++){
for(int altura = 0;altura<30;altura++){
sf::RectangleShape retangulo;
retangulo.setFillColor(sf::Color::Blue);
retangulo.setSize(sf::Vector2f(10, 10));
retangulo.setOutlineColor(sf::Color::Red);
retangulo.setOutlineThickness(5);
retangulo.setPosition(sf::Vector2f(largura, altura));
window.draw(retangulo);
}}
}
Help needed :/