This is a clone of the original and legendary Pacman game, written in C++. I used Visual Studio 2019 and vcpkg to install the required libraries such as SDL2.
This is how you install SDL2 with vcpkg and use it in Visual Studio 2019.
- Download and install vcpkg.
- Open powershell and, in the vcpkg root directory, run the vcpkg bootstrapper
bootstrap-vcpkg.bat
. - To see what packages are available, for instance SDL2, type
.\vcpkg.exe search sdl2
. - Download and install SDL2 library, type
.\vcpkg.exe install sdl2:x86-windows
- After the installation is complete, type
.\vcpkg.exe integrate install
to integrate vcpkg with your Visual Studio. - Open Visual Studio and create your new SDL2 project.
- In the "Solution Explorer" side bar, right click on the name of your Solution and select Properties at the very bottom.
- In "Linker", pick "Console (/SUBSYSTEM:CONSOLE)" in "SubSystem" and make sure that "Configuration" at the top is "All Configurations".
- Then change "Configuration" to "Debug", go to "Linker" > "Input" and in "Additional Dependencies", click on the dropdown icon then Edit and in the top editable window add
SDL2maind.lib
. Press OK and then Apply. - Finally, change "Configuration" to "Release", go to "Linker" > "Input" and in "Additional Dependencies", click on the dropdown icon then Edit and in the top editable window add
SDL2main.lib
. Press OK, then Apply and OK to leave the menu. - In your cpp code, add #include
<SDL2/SDL.h>
. Well done, the SDL2 library is now available for use.
Enjoy. I am groot.