Language: EN

raylib-libreria-open-source-para-hacer-videojuegos

Raylib, Open Source library for making video games

Raylib is an Open Source library for making video games, designed to be simple and easy to use, and is available on a wide variety of platforms and languages.

Raylib seeks to move away from more complex and heavy video game solutions and engines, focusing on the most basic and fundamental aspects of video game development.

Thus, it eliminates the need for additional dependencies or adding huge video game frameworks or engines to our project. It simply works, without the need for great complications, and with an old-school flavor that is appreciated.

Among the fundamental features of the library, we find, logically, the creation of 2D and 3D graphics. Its syntax is inspired by Borland BGI graphics and XNA framework. It is compatible with accelerated graphics using OpenGL (1.1, 2.1, 3.3, 4.3 or ES 2.0).

raylib-2d-example

In addition to the graphical aspect, raylib incorporates functionalities for simple physics simulation, such as collisions between objects. The set of core functions is completed with tools for user input management, such as keyboard, mouse, or gamepad.

As we had anticipated, one of the most interesting points is its compatibility with multiple architectures and OS. These include Windows, Linux, macOS, Raspberry Pi, Android, and Web (HTML5). In fact, in theory, it should be compatible with any platform that can run C code and has OpenGL graphics.

Raylib is developed entirely in C (C99). However, there are bindings that allow us to use raylib from +60 programming languages. These include C#, Java, Rust, Dart, Go, Python, among others.

As we said, one of the strong points of raylib is its ease of use, compared to other much heavier solutions. For example, this is what a simple “hello world” developed with raylib would look like.

#include "raylib.h"

int main(void)
{
    InitWindow(800, 450, "raylib - basic window");

    while (!WindowShouldClose())
    {
        BeginDrawing();
        ClearBackground(RAYWHITE);
        DrawText("Congratulations, you have created a window!", 190, 200, 20, LIGHTGRAY);       
        EndDrawing();
    }

    CloseWindow();

    return 0;
}

As we can see, it has not been necessary to add a long list of dependencies, or use a complex graphics engine. We only need to add the dependency to raylib and the “skeleton” code necessary to run it in our application is really simple.

The project has a large library of examples that document the main functions of the library. These can be executed directly from the web, thanks to raylib’s compatibility with HTML5. They are available at https://www.raylib.com/examples.html.

raylib-3d-example

In its ten years of development, raylib has received numerous awards, including prestigious awards from well-known companies, such as Google and Epic Games.

Raylib is complemented by a wide collection of very interesting libraries from the same author, such as raymath for mathematics, raudio for sound playback, or raygui for creating UIs, among others.

The project is excellently documented, with the examples we have mentioned above being noteworthy, as well as the “Cheatsheet” available at this link.

Raylib is Open Source and is distributed under the zlib/libpng license. All the code is available at https://github.com/raysan5/raylib/, where you will also find detailed instructions for making it work on different platforms.