News for hackers. Stuff that matters.

kiriin

Re:How to make Flappy Bird with C++ on Thursday August 25, 2022 @10:17AM (#32594015)
>std::shared_ptr<sf::RenderWindow> window; >std::shared_ptr<sf::Sprite> background, bird, pipeBottom, pipeTop;

None of that should be shared_ptr, in fact they shouldn't be pointers at all.

>auto flappy = std::make_shared<FlappyBird>(); >flappy->run();

That would work just fine as a global in main.cpp

FlappyBird flappy;