Raylib

From Wikipedia, the free encyclopedia
raylib
raylib official logo
Developer(s)Ramon Santamaria, and contributors
Initial releaseNovember 18, 2013; 8 years ago (2013-11-18)
Stable release
4.0.0 / November 4, 2021; 50 days ago (2021-11-04)
Repositorygithub.com/raysan5/raylib
Written inC, specifically C99
PlatformWindows, Linux, macOS, FreeBSD, Android, Raspberry Pi, HTML5
TypeAPI
Licensezlib License[1][2]
Websitewww.raylib.com

Raylib (stylized in lowercase as raylib) is a cross-platform open-source software development library. The library is meant to create graphical applications and games. The official website introduces it as "a simple and easy-to-use library to enjoy video games programming."[3][4]

The library is highly inspired by the Borland BGI graphics library and by the XNA framework and it's designed to be well suited for prototyping, tooling, graphical applications, embedded systems and education. The source code is written in plain C (C99) and it aims to be easy for beginners, distributed under a zlib/libpng OSI certified open-source license. It supports compilation to several target platforms, including Windows, Linux, macOS, FreeBSD, Android, Raspberry Pi and HTML5.

raylib has been ported to more than 50 programming languages (but most of those are not stable ports) in the form of bindings.[5] raylib provides traditional documentation as well as a cheatsheet for a brief explanation on its functions and features.[6]

History[]

raylib development started in August 2013 by Ramon Santamaria to support a game development course, focused on students with no previous coding experience and artistic profile; the library acted as a direct replacement of WinBGI. During the course, raylib was further developed based on the feedback of the students and by June 2014, the library was starting to be showcased in several game development events in Barcelona.

raylib 1.0 was released in November 2013 and it featured around 80 functions for window and inputs management, basic 2D and 3D shape drawing, texture loading and drawing, font loading, text drawing, audio system management and audio file loading and playback. The first raylib version had 8 subsequent minor releases (from raylib 1.1 to raylib 1.8), along the course of 5 years, which each introduced some new features. Some of the most notable improvements were Android, WebAssembly and Raspberry Pi support, multiple OpenGL backends, VR support and ten examples.

raylib 2.0 was released in July 2018 and removed all external dependencies from the build system. It also exposed a number of configuration options in the build system, to minimize size and increase support, supporting various continuous integration systems. Along the following two years, parts of the library were reviewed updated, and the ecosystem was built out. A single minor release, raylib 2.5, was released during this period.

raylib 3.0 was released in April 2020, refactoring many parts of the code to improve portability and bindings. It involved moving global variables to contexts, added support for custom memory allocators, a filesystem for loading assets and over 115 code examples. It received a minor update, raylib 3.5, in December 2020.

raylib 4.0 was released in November 2021, featuring a complete naming review for library consistency and coherency: function names, parameters, descriptions, comments and log output messages were reviewed. It added an internal Events Automation System and exposed game-loop control for the user. It also features some of its internal libraries to be used as standalone modules: rlgl and raymath. Zig and Odin programming languages officially support raylib. It has been the biggest update of the library to date.

Features[]

raylib offers the following features:[7][8]

  • Support for multiple platforms, including Windows, Linux, macOS, Raspberry Pi Android and HTML5
  • Support for OpenGL 1.1, 2.1, 3.3, 4.3 and OpenGL ES 2.0 as backend
  • Image, textures and fonts loading and drawing from several formats
  • Audio loading and playing from several formats and streaming support
  • Math operations for vectors, matrices, and quaternions
  • 2D rendering with a camera, including automatic sprites batching
  • 3D models rendering including custom shaders and postprocessing shaders
  • Support for VR simulations with configurable HMD device parameters
  • Support for animated as well as non-animated 3D and 2D models
  • An example collection with +120 code examples

Reception and adoption[]

raylib was primarily intended for education on video games and graphics programming. However, since many developers found it simple and easy to use, it has been adopted in various hobbyist projects.

Multiple communities exist for raylib on services such as Reddit and Discord. On the raylib website, a handful of social networks are listed, including the personal sites of Santamaria, and communities dedicated to raylib.[9]

GitHub lists over 120 projects on the raylib topic.[10][11]

Software architecture[]

Modules[]

raylib architecture as of version 4.0.0[12]

raylib consists of several modules that are exposed to the programmer through the API.

  • core – Handles the window creation and OpenGL context initialization as well as inputs management (keyboard, mouse, gamepad and touch input)
  • rlgl – Handles OpenGL backend, abstracting multiple versions to a common API. This module can be used standalone.
  • shapes – Handles basic 2D shape rendering (line, rectangle, circle...) and basic collision detection
  • textures – Handles image and texture loading (CPU and GPU) and management, including image manipulation functionality (crop, scale, tint, etc.)
  • text – Handles fonts loading as spritesheet and text rendering. Also includes some text processing functionality (join, split, replace, etc.)
  • models – Handles 3D model loading and rendering, including support for animated models
  • raudio – Handles audio device management and audio file loading and playback, including streaming support. This module can be used standalone.
  • raymath – Provides a set of math functions for vectors, matrices and quaternions

Bindings[]

raylib has bindings for more than 50 different programming languages, created by its community, including Rust, Go, C#, Lua, Python, and Nim. A list of bindings is available in the BINDINGS.md file in the raylib GitHub repository.

Many new programming languages like Beef, Odin and Ring provides binding for raylib. The Ring programming language includes raylib in the standard library.[13][14]

Add-ons[]

The raylib community has contributed several add-ons to extend the features and connection of raylib with other libraries. Some of the modules are:

  • raygui – Immediate mode GUI module for raylib[15]
  • physac – physics module intended to be used with raylib[16]
  • libpartikel – particle system module for raylib[17]
  • spine-raylib – Spine animations integration module for raylib[18]
  • cimgui-raylib – Dear Imgui integration module for raylib[19]

Awards[]

raylib has won a number of awards, which it proudly displays on its website.

  • In April 2019, Santamaria was awarded with the Google Open Source Peer Bonus award for contributing to the open-source ecosystem with raylib.[20]
  • In August 2020, raylib was awarded with an Epic MegaGrant by Epic Games to support its development. [21]
  • In April 2021, Santamaria was awarded with another Google Open Source Peer Bonus award for the same reasons.[22]

Example[]

The following program in the C programming language uses raylib to create a white window with some centered text.

#include "raylib.h"
int main(void)
{
    const int screenWidth = 800;
    const int screenHeight = 450;
    InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
    SetTargetFPS(60);

    while (!WindowShouldClose())
    {
        BeginDrawing();
            ClearBackground(RAYWHITE);
            DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
        EndDrawing();
    }

    CloseWindow();
    return 0;
}

See also[]

References[]

  1. ^ "License".
  2. ^ "raylib GitHub". 10 October 2021.
  3. ^ Thomas (2019-08-01). "Best 2D Game Engines: The Complete List (2020)". Thomas Gervraud. Retrieved 2020-07-20.
  4. ^ "A Snake Game Written in PHP (with Raylib)". thephp.website. Retrieved 2020-07-20.
  5. ^ "raysan5/raylib". GitHub. Retrieved 2020-07-15.
  6. ^ "raylib - cheatsheet". raylib. Retrieved 2021-02-10.
  7. ^ "raylib–A C++ Game Library Perfect For Beginners". www.gamefromscratch.com. 24 July 2016. Retrieved 2020-07-20.
  8. ^ "Raylib 2.5 Released". www.gamefromscratch.com. 3 June 2019. Retrieved 2020-07-20.
  9. ^ "raylib". Retrieved 2021-10-28.
  10. ^ "Build software better, together". GitHub. Retrieved 2020-07-15.
  11. ^ "raysan5/raylib". GitHub. Retrieved 2020-07-15.
  12. ^ "raylib". Retrieved 2021-10-28.
  13. ^ Beginning Ring Programming - From Novice to Professional | Mansour Ayouni | Apress.
  14. ^ "Developing Games using RingRayLib — Ring 1.13 documentation". ring-lang.sourceforge.net. Retrieved 2020-07-20.
  15. ^ Ray (2020-07-15), raysan5/raygui, retrieved 2020-07-15
  16. ^ Fisac, Víctor (2020-07-14), victorfisac/Physac, retrieved 2020-07-15
  17. ^ Briemann, David Linus (2020-06-10), dbriemann/libpartikel, retrieved 2020-07-15
  18. ^ WEREMSOFT (2020-06-27), WEREMSOFT/spine-raylib-runtimes, retrieved 2020-07-15
  19. ^ WEREMSOFT (2020-07-12), WEREMSOFT/c99-raylib-cimgui-template, retrieved 2020-07-15
  20. ^ "Google Open Source Peer Bonus winners are here!". Google Open Source Blog. Retrieved 2020-07-15.
  21. ^ "RayLib receives an Epic MegaGrant". GameFromScratch.com. 2020-08-07. Retrieved 2020-08-10.
  22. ^ "Announcing the First Group of Google Open Source Peer Bonus winners in 2021!". Google Open Source Blog. Retrieved 2021-04-27.

External links[]

Retrieved from ""