-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Beginning C++ Game Programming
By :

As setting up a project is a fiddly process, we will go through it step by step so that we can start getting used to it:
Figure 1.9: Starting a new project in VS 2022
Figure 1.10: Create a new project screen
Figure 1.11: Configuring your new project
Timber
in the Project name field. Note that this causes Visual Studio to automatically configure the Solution name field to the same name.VS Projects
folder that we created in the previous tutorial. This will be the location where all our project files will be kept.Figure 1.12: Visual Studio code editor
SFML
folder. From the main menu, select Project | Timber properties…. You will see the following window: Figure 1.13: Timber Property page
In the preceding screenshot, the OK, Cancel, and Apply buttons are not fully formed. This is likely a glitch with Visual Studio not handling my screen resolution correctly. Yours will hopefully be fully formed. Whether your buttons appear like mine do or not, continuing with the tutorial will be the same.
Next, we will begin to configure the project properties. As these steps are quite intricate, I will cover them in a new list of steps.
At this stage, you should have the Timber Property Pages window open, as shown in the preceding screenshot at the end of the previous section. Now, we will begin to configure some properties while using the following annotated screenshot for guidance:
Figure 1.14: Configuring the project properties
We will add some intricate and important project settings in this section. This is the laborious part, but we will only need to do this once per project and it will get easier and faster each time you do it. What we need to do is tell Visual Studio where to find a special type of code file from SFML. The special type of file I am referring to is a header file. Header files are the files that define the format of the SFML code so that when we use the SFML code, the compiler knows how to handle it. Note that the header files are distinct from the main source code files, and they are contained in files with the .hpp
file extension. All this will become clearer when we eventually start adding our own header files in the second project. In addition, we need to tell Visual Studio where it can find the SFML library files. To achieve these things, on the Timber Property Pages window, perform the following three steps, which are numbered in the preceding screenshot:
SFML
folder is located, followed by \SFML\include
. The full path to type, if you located your SFML
folder on your D drive, is as shown in the preceding screenshot – that is, D:\SFML\include
. Vary your path if you put SFML on a different drive.SFML
folder is, followed by \SFML\lib
. So, the full path to type if you located your SFML
folder on your D drive is, as also shown in the following screenshot, D:\SFML\lib
. Vary your path if you put SFML on a different drive: Figure 1.15: Additional Library Directories
Figure 1.16: Linker input configuration
sfml-graphics-d.lib;sfml-window-d.lib;sfml-system-d.lib;sfml-network-d.lib;sfml-audio-d.lib
; at the indicated place. Be extra careful to place the cursor exactly in the right place and not overwrite any of the text that is already there.Phew; that’s it! We have successfully configured Visual Studio and can move on to planning the Timber!!! project.