Use a class:
#include <SFML/Graphics.hpp>
class Application
{
private:
sf::RenderWindow Window;
sf::String Hello;
void DrawStuff();
public:
Application();
void Run();
};
Application::Application()
{
Window.Create(sf::VideoMode(326, 600), "Title");
Hello.SetText("Hello!");
Hello.SetColor(sf::Color(0, 128, 128));
Hello.SetPosition(100.f, 100.f);
Hello.SetSize(30.f);
}
void Application::DrawStuff()
{
Window.Draw(Hello);
}
void Application::Run()
{
while (Window.IsOpened())
{
sf::Event Event;
while (Window.GetEvent(Event))
{
if (Event.Type == sf::Event::Closed)
Window.Close();
}
DrawStuff();
Window.Display();
}
}
int main()
{
Application Game;
Game.Run();
return 0;
}
I didn't test it so it might have some bugs, but you get the idea.