Reputation: 847
I am getting my feet wet with C++ and SFML and have literally been pulling my hair out just trying to get the library to even connect to VS.
Now I am following a VERYYYY basic tutorial of just creating a window.
When i get to the part of creating
> sf::Event event;
I get the error that the local variable isn't initialized.
I searched online but nothing come sup for this specific issue.
I tried to see if there is update to documentation but i cant find any.
Anyone have any idea?
UPDATE:
This is the new fix for SFML 3 sf::Event
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode({200, 200}), "SFML works!");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
while (window.isOpen())
{
while (const std::optional event = window.pollEvent())
{
if (event->is<sf::Event::Closed>())
window.close();
}
window.clear();
window.draw(shape);
window.display();
}
}
Upvotes: 0
Views: 184
Reputation: 163
Follow the steps here very deliberately.
https://www.sfml-dev.org/tutorials/3.0/getting-started/visual-studio/
Remember some directories will need to be added to ALL, while some are just for release/ debug.
Do not forget to copy your .dll files and put them where your executable can use them.
Upvotes: 0