1
General / Help with definition in c++/SFML
« on: November 18, 2016, 03:21:53 pm »
Hello,
I have a question. How can I make a definition? I know I'm a beginner xD. For example. I want to make
I have a question. How can I make a definition? I know I'm a beginner xD. For example. I want to make
#include <SFML/Graphics.hpp>
void example(){
//HELP
}
int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
sf::CircleShape shape(100.f); //that should be in the definition
shape.setFillColor(sf::Color::Green);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(shape);
window.display();
}
return 0;
}
void example(){
//HELP
}
int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
sf::CircleShape shape(100.f); //that should be in the definition
shape.setFillColor(sf::Color::Green);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(shape);
window.display();
}
return 0;
}