Hi, I'm new to SFML and I'd like to know how to program something by doing it object oriented. The problem is, when I make a static method for rendering a window for example, the object won't be recognized outside of the method in the class. I'd like to make classes such as Graphics where I can collect all the textures, Render, Player for physics and so on. Down below you can see one of the opportunities I've tried, I'm aware that it cannot work because the object window can be only seen within the method "createWindow". I just need an advice on how it works with SFML so I can get forward. Thanks in advance.
#include <SFML/Graphics.hpp>
#include <iostream>
class Game
{
public:
static void createWindow()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "Test");
}
static void render()
{
while (window.isOpen()) //i've also tried Game::window and so on
{
window.clear();
window.display();
}
}
};
int main()
{
Game::createWindow();
Game::render();
}