(raylib)=
# Raylib

`raylib` is a simple library for video game programming.

## Installation

::::{tab-set}
:::{tab-item} Windows x86-64
1. Download the latest `raylib-*_win64_mingw-w64.zip` (**not** `*msvc*`) from the [releases](https://github.com/raysan5/raylib/releases/).
1. Unpack it to the directory where you store your projects and rename it, so you can reach the directory using `../raylib` from your projects.
:::
:::{tab-item} MacOS
```sh
brew install raylib
```
:::
:::{tab-item} Linux
Available as `raylib`, e.g.,
```sh
pacman -S raylib
```
:::
::::

## Running

1. Create a new project and paste [the basic window example](https://www.raylib.com/examples/core/loader.html?name=core_basic_window) in your `main.c`.
1. Include the following arguments in your `.vscode/tasks.json`:

   ::::{tab-set}
   :::{tab-item} Windows
   ```json
    "args": [
       "'@compile_flags.txt'",
       "-lmsvcrt",
       "-lraylib",
       "-lgdi32",
       "-lwinmm",
       "-L../raylib/lib",
   ```
   :::
   :::{tab-item} Linux/MacOS
   ```{warning}
   Was not tested on MacOS. Dependent on where `brew` installs the library, explicitly providing library path using `-L ..` may be required.
   ```
   Include `-lraylib` as follows:
   ```json
    "args": [
     "'@compile_flags.txt'",
     "-lraylib",
   ```
   :::
   ::::
1. Only on Windows (and maybe MacOS):

   Add the include path to your `compile_flags.txt`, for example for Windows:
   ```text
   -I../raylib/include
   ```

1. On Windows, the CodeLLDB debugger cannot start the program. Workaround: Use `build` and `run` tasks.

   A game window should open up as shown on the [examples page](https://www.raylib.com/examples.html).
   
:::{card} Troubleshooting
Symptom: Compilation errors on Windows

Solution: You may have to add additional libraries to link against. Refer to <https://github.com/raysan5/raylib/issues/4846>

Symptom: The game window does not open.

Solution: Your graphics card drivers may not have 3D acceleration support.
:::
<!--
The problem could be that raylib is not compiled with debug symbols or not clang. Try compiling with clang.
-->