As you probably know, drawing something on screen requires a window to be present. Luckily, SFML allows us to easily open and manage our very own window! Let's start out as usual by adding a file to our project, named Main.cpp
. This will be the entry point to our application. The bare bones of a basic application look like this:
#include <SFML/Graphics.hpp>
void main(int argc, char** argv[]){
}
Note that we've already included the SFML graphics header. This will provide us with everything needed to open a window and draw to it, so without further ado, let's take a look at the code that opens our window:
#include <SFML/Graphics.hpp> void main(int argc, char** argv[]){ sf::RenderWindow window(sf::VideoMode(640,480), "First window!"); ...
No credit card required