> For the complete documentation index, see [llms.txt](https://docs.flatredball.com/gum/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flatredball.com/gum/code/getting-started/setup/empty-project-before-adding-gum/raylib-raylib-cs.md).

# raylib (raylib-cs)

## Introduction

Gum can be used with raylib using raylib-cs (C# bindings for raylib). At the time of this writing, raylib-cs supports:

* Gum layout engine
* Gum visual objects (runtimes) like SpriteRuntime, NineSliceRuntime, and TextRuntime
* Gum Forms (partial support)

If you are interested in using raylib, please join the discord channel and provide feedback on this initial implementation.

## Creating an New Project

Before using Gum, you should first verify that you can create a normal raylib-cs project. For more information see the raylib-cs readme: <https://github.com/raylib-cs/raylib-cs>.

If you are starting a branch new raylib project from scratch, you can follow these steps:

{% tabs %}
{% tab title="Visual Studio" %}
First, create an empty console project

1. Open Visual Studio
2. Select File -> New Project, or select the **Create a new project** option in the popup window.
3. Select the option to create a **Console App**
4. Enter a name, select a location, then click **Next**
5. Select the desired **Framework** and other options, then click **Create**

Next, add the needed NuGet packages:

1. Expand your game project in the Solution Explorer
2. Right-click on **Dependencies** and select **Manage NuGet Packages**
3. Search for and install `Raylib-cs` . As of November 2025 the newest version is 7.0.2.
   {% endtab %}
   {% endtabs %}

{% hint style="warning" %}
If you name your project RaylibGum (with any capitalization) you may get a runtime error about not being able to access the GumService type. Use any other name for your project to avoid this problem.
{% endhint %}

Once you have your project set up, it might look similar to the following code block:

```csharp
using Raylib_cs;
namespace raylibExample1;

public class Program
{
    // STAThread is required if you deploy using NativeAOT on Windows - See https://github.com/raylib-cs/raylib-cs/issues/301
    [STAThread]
    public static void Main()
    {
        const int screenWidth = 800;
        const int screenHeight = 450;

        Raylib.InitWindow(screenWidth, screenHeight, "Gum Sample");


        while (!Raylib.WindowShouldClose())
        {
            Raylib.BeginDrawing();
            Raylib.ClearBackground(Raylib_cs.Color.SkyBlue);

            Raylib.EndDrawing();
        }
        Raylib.CloseWindow();
    }
}
```

Next, you can begin adding Gum to your project. For more information see the [Adding/Initializing Gum](/gum/code/getting-started/setup/adding-initializing-gum/raylib-raylib-cs.md) page.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.flatredball.com/gum/code/getting-started/setup/empty-project-before-adding-gum/raylib-raylib-cs.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
