Jump to content
Search

This wiki is under development. Features may be missing. Data loss is unlikely, but possible. Read the announcement.

Raylib

From Ubuntu Wiki

Raylib is a popular library for developing video games.

Install dev tools

You will need GCC, make, and git:

sudo apt install build-essential git

Install dependencies

Run the following command:

sudo apt install \
libasound2-dev \
libx11-dev \
libxrandr-dev \
libxi-dev \
libgl1-mesa-dev \
libglu1-mesa-dev \
libxcursor-dev \
libxinerama-dev \
libwayland-dev \
libxkbcommon-dev

Download Raylib

Use git to clone the quickstart repo, replacing my-new-game with any project name that you want.

git clone https://github.com/raylib-extras/raylib-quickstart.git my-new-game

Build the library

First, change into the project directory:

cd my-new-game

Then change into the build directory with cd build and run:

./premake5 gmake

Compile the example game

Go back to the project root with cd .. and run:

make

The build outputs are in the bin directory.

To run the example game:

./bin/Debug/raylib-quickstart

Change the code

The source code for the game is in the src directory.

You can edit it with your text editor of choice. For example, with Vim:

vim src/main.c

Change a line in the code:

- DrawText("Hello Raylib", 200,200,20,WHITE);

+ DrawText("Hello Raylib on Ubuntu", 200,200,20,WHITE);

Then compile the game again to see the difference:

./bin/Debug/raylib-quickstart

Resources