Added more information, some design changes and more clarity to some points.

master
Pacadamian Motato 1 year ago
parent
commit
d8c1b7921d
1 changed files with 47 additions and 13 deletions
  1. +47
    -13
      Using-raylib-in-VSCode.md

+ 47
- 13
Using-raylib-in-VSCode.md

@ -1,40 +1,74 @@
[VSCode](https://code.visualstudio.com/) is an excellent choice of code editor when it comes to raylib. Getting set up with a new VSCode project is easy. [VSCode](https://code.visualstudio.com/) 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 rather than building Raylib from source (should work without changes on Windows if you install Raylib mingw release).
[!NOTE]
Make sure you install Raylib from the official release binaries which you can find [here](https://github.com/raysan5/raylib/releases), rather than building Raylib from source (should work without changes on Windows if you install Raylib mingw release).
### Step 0
If you have not installed MinGW or W64DevKit yet, go [here](https://github.com/raysan5/raylib/wiki/Working-on-Windows#build-one-example-using-gccg) 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.
### Step 1 ### Step 1
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](https://github.com/raysan5/raylib/tree/master/projects/VSCode). 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](https://github.com/raysan5/raylib/tree/master/projects/VSCode).
**Note**: You can use this [Zip Tool](https://kinolien.github.io/gitzip/) to download only the VSCode folder as a zip.
[!NOTE]
You can use the [Zip Tool](https://kinolien.github.io/gitzip/) to download only the VSCode folder as a zip.
### Step 2 ### Step 2
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.
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
In `c_cpp_properties.json` make sure that `compilerPath`` is correct:
```json ```json
"includePath": [ "includePath": [
"C:/raylib/raylib/src/**", "C:/raylib/raylib/src/**",
"${workspaceFolder}/**" "${workspaceFolder}/**"
], ],
"compilerPath": "C:/raylib/mingw/bin/gcc.exe",
```
in some cases it's **mingw32** instead of **mingw** (which comes with installer v2.0). In version 4, the compiler path is as follows:
```json
"compilerPath": "C:/raylib/w64devkit/bin/gcc.exe", "compilerPath": "C:/raylib/w64devkit/bin/gcc.exe",
``` ```
Check your folder to see which one you have. In **tasks.json** also you have to make this change for compile to occur.
Similarly in `tasks.json` also you have to make this change for compile to occur.
#### Extra Configuration for Windows Subsystem for Linux Users #### Extra Configuration for Windows Subsystem for Linux Users
If you are on Windows and use [Windows Terminal](https://docs.microsoft.com/en-us/windows/terminal/) with the [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/about) 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. If you are on Windows and use [Windows Terminal](https://docs.microsoft.com/en-us/windows/terminal/) with the [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/about) 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`. You need to make this change **twice** i.e. you should see `"externalConsole": true,` in both configurations.
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.
### Step 3 ### Step 3
@ -42,7 +76,7 @@ Install the "C/C++" VSCode extension. (From Menu - **File > Preferences > Extens
### Step 4 ### Step 4
Try launching by using the "Debug" launch configuration in the Debug tab.
Try launching by using the "Debug" launch configuration in the Debug tab or press `F5`.
_or_ _or_

Loading…
Cancel
Save