Setting up SFML
This short tutorial will guide you through downloading the SFML files that allow us to include the functionality contained in the SFML library in our projects. In addition, we will see how we can use the SFML DLL files that will enable our compiled object code to run alongside SFML. To set up SFML, follow these steps:
- Visit this link on the SFML website: http://www.sfml-dev.org/download.php. Click on the button that says Latest stable version, as shown here:
Figure 1.6: Downloading SFML 2.6
- By the time you read this book, the latest version will almost certainly have changed. This won’t matter if you do the next step just right. We want to download the 32-bit version. This might sound counter-intuitive because you probably (most commonly) have a 64-bit PC. The reason we will download the 32-bit version is that 32-bit apps can run on both 32- and 64-bit machines. Furthermore, we need to get the Visual Studio 22 version. Click the Download button that’s shown in the following screenshot:
Figure 1.7: Downloading SFML 17_22
- When the download completes, create a folder at the root of the same drive where you installed Visual Studio and name it
SFML
. Also, create another folder at the root of the drive where you installed Visual Studio and call itVS Projects
. - Finally, unzip the SFML download. Do this on your desktop. My file was called
SFML-2.6.0-windows-vc17-32-bit.zip
but yours may be different to reflect a newer version of SFML. When unzipping is complete, you can delete the.zip
folder. You will be left with a single folder on your desktop. Its name will reflect the version of SFML that you downloaded. Double-click this folder to see its contents; I have a folder calledSFML-2.6.0
. Now double-click again into the folder.
The following screenshot shows what my SFML folder’s content looks like. Yours should look the same.
Figure 1.8: SFML folder contents
Copy the entire contents of this folder and paste all the files and folders into the SFML folder that you created in step 3. For the rest of this book, I will refer to this folder simply as “your SFML folder”.
Now, we are ready to start using C++ and SFML in Visual Studio.