-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Using raylib in VSCode
VSCode is an excellent choice of code editor when it comes to raylib. Getting set up with a new VSCode project is easy.
[!NOTE] Make sure you install Raylib from the official release binaries which you can find here, rather than building Raylib from source (should work without changes on Windows if you install Raylib mingw release).
If you have not installed MinGW or W64DevKit yet, go here and follow instructions to set up C/C++ in your local machine.
Additionally further steps assume that you have installed both raylib
and w64devkit
in C:\raylib\
folder and your folder structure looks like this:
.
├── raylib
│ ├── CHANGELOG
│ ├── include
│ ├── lib
│ ├── LICENSE
│ ├── README.md
│ └── src
└── w64devkit
├── bin
├── COPYING.MinGW-w64-runtime.txt
├── Dockerfile
├── include
├── lib
├── libexec
├── README.md
├── share
├── src
├── VERSION.txt
├── w64devkit.exe
├── w64devkit.ini
└── x86_64-w64-mingw32
Feel free to install differently but do the changes to the configuration files accordingly.
Copy the VSCode folder (and all its contents) from raylib/projects/VSCode (from your installed directory) to your desired project location. These files can also be found here.
[!NOTE] You can use the Zip Tool to download only the VSCode folder as a zip.
Make sure you set the proper paths to your local build of raylib in c_cpp_properties.json
and tasks.json
. These will be specific to your installation of raylib.
In c_cpp_properties.json
make sure that `compilerPath`` is correct:
"includePath": [
"C:/raylib/raylib/src/**",
"${workspaceFolder}/**"
],
"compilerPath": "C:/raylib/w64devkit/bin/gcc.exe",
Similarly in tasks.json
also you have to make this change for compile to occur.
If you are on Windows and use Windows Terminal with the Windows Subsystem for Linux as your default shell, you won't be able to debug or build your game with the default settings. That's because the build configuration will try to launch cmd
to open a standard Windows shell which won't exists in your Linux distribution.
To make it work, edit launch.json
in the .vscode
folder so that the externalConsole
property is true
instead of false
.
[!IMPORTANT]
You need to make this change twice i.e. you should see "externalConsole": true,
in both configurations.
Install the "C/C++" VSCode extension. (From Menu - File > Preferences > Extensions)
Try launching by using the "Debug" launch configuration in the Debug tab or press F5
.
or
You can Build the game using View > Command Palette (or Ctrl + Shift + P), Type Run Task and press Enter. And Select the Build Debug option. A game executable will be created in the project folder. You can see any error in the console
www.raylib.com | itch.io | GitHub | Discord | YouTube
- Architecture
- Syntax analysis
- Data structures
- Enumerated types
- External dependencies
- GLFW dependency
- libc dependency
- Platforms and graphics
- Input system
- Default shader
- Custom shaders
- Coding conventions
- Integration with other libs
- Working on Windows
- Working on macOS
- Working on GNU Linux
- Working on Chrome OS
- Working on FreeBSD
- Working on Raspberry Pi
- Working for Android
- Working for Web (HTML5)
- Creating Discord Activities
- Working anywhere with CMake
- CMake Build Options
- raylib templates: Get started easily
- How To: Quick C/C++ Setup in Visual Studio 2022, GCC or MinGW
- How To: C# Visual Studio Setup
- How To: VSCode
- How To: Eclipse
- How To: Sublime Text
- How To: Code::Blocks