Raylib

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

raylib
Developer(s)Ramon Santamaria, and contributors
Initial releaseNovember 18, 2013 (2013-11-18)
Stable release
3.0.0 / April 1, 2020 (2020-04-01)
Repositorygithub.com/raysan5/raylib
Written inC, specifically C99
PlatformWindows, Linux, macOS, FreeBSD, Android, Raspberry Pi, HTML5
TypeAPI
Licensezlib License[1][2]
Websitewww.raylib.com

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

raylib has been ported to more than 40 programming languages in the form of bindings, allowing users to access the library functionality in their favorite programming language.[5]

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 shapes drawing, textures loading and drawing, fonts loading, text drawing, basic 3d shapes drawing, audio system management and audio files loading and playing. First raylib version went through 8 subversion iterations (from raylib 1.1 to raylib 1.8), growing version after version with the addition of new modules, new platforms and new features along 5 years. Some of the most notable improvements were Android, WebAssembly and Raspberry Pi support, multiple OpenGL backends, VR support and +50 examples to explore and learn.

raylib 2.0 was released in July 2018 and for the first time the library removed all external dependencies, all required libraries are included and compiled along raylib. This version also exposed a number of configuration options for the library features to minimize size and it greatly improved build system, supporting various continuous integration systems. Along the following two years multiple parts of the library were reviewed and improved and well as all the library ecosystem. One raylib 2.5 iteration was released in the middle of this process.

raylib 3.0 was released in April 2020 featuring several big internal redesigns to improve library portability and bindings generation. Some of the key changes of raylib 3.0 were moving global variables to a global state contexts, support custom memory allocators, a centralized file system for memory data loading and a collection of +115 code examples to explore and learn.

raylib has kept growing and improving along several years with the addition of multiple features but always keeping its core value: being a simple and easy-to-use library to enjoy programming.[6][7][8]

Features

raylib comes with the following features:[9][10]

  • Support for many platforms, including Windows, Linux, macOS, Android and HTML5
  • Support for OpenGL 1.1, 2.1, 3.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, including configurable HMD device parameters
  • Support for animated as well as non-animated 3D and 2D models
  • Big examples collection with +115 code examples

Reception and adoption

raylib was primary intended for education on video games and graphics programming but due to its simplicity and ease of use, it has been also adopted by many hobbyist game developers.

There are active and growing communities in multiple networks like reddit and Discord.[11]

GitHub lists over 120 projects on raylib topic.[12][13]

Software architecture

Modules

raylib architecture as of version 3.0.0

raylib consist of several modules that are exposed to the programmer through the API. Actually, every module is contained in a single C code file and some modules can be used in standalone mode:

  • 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 as standalone.
  • shapes – Handles basic 2D shapes rendering (line, rectangle, circle...) and basic collision detection
  • textures – Handles Images and textures loading (CPU and GPU) and management, including Image manipulation functionality (crop, scale, tint...)
  • text – Handles fonts loading as spritesheet and text rendering, also includes some text management functionality (join, split, replace...)
  • models – Handles 3D models loading and drawing, including support for animated models
  • raudio – Handles audio device management and audio files loading and playing, including streaming support. This module can be used as standalone.
  • raymath – Provides a set of math functions for Vector2, Vector3, Quaternion and Matrix structures

Bindings

raylib has language bindings for almost 50 different programming languages, provided by multiple contributors. Some of the languages include: Rust, Go, C# and Lua. All bindings can be viewed in the BINDINGS.md file in the GitHub repository of the library. Many new programming languages like Beef, Odin and Ring provides binding for raylib.

The Ring programming language includes raylib in the standard library.[14][15]

Add-ons

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

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

Awards

In April 2019, raylib developer was awarded with the Google Open Source Peer Bonus award for contributing to the open-source ecosystem with raylib.[21]

In August 2020, raylib was awarded with an Epic MegaGrant by Epic Games to support raylib development. [22]

Examples

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".
  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. "Releases · raysan5/raylib". GitHub. Retrieved 2020-07-15.
  7. "raylib history". raylib github history.
  8. 262588213843476. "raylib: 6 years of fun". Gist. Retrieved 2020-07-23.CS1 maint: numeric names: authors list (link)
  9. "raylib–A C++ Game Library Perfect For Beginners". www.gamefromscratch.com. Retrieved 2020-07-20.
  10. "Raylib 2.5 Released". www.gamefromscratch.com. Retrieved 2020-07-20.
  11. "Join the raylib Discord Server!". Discord. Retrieved 2020-07-15.
  12. "Build software better, together". GitHub. Retrieved 2020-07-15.
  13. "raysan5/raylib". GitHub. Retrieved 2020-07-15.
  14. Beginning Ring Programming - From Novice to Professional | Mansour Ayouni | Apress.
  15. "Developing Games using RingRayLib — Ring 1.13 documentation". ring-lang.sourceforge.net. Retrieved 2020-07-20.
  16. Ray (2020-07-15), raysan5/raygui, retrieved 2020-07-15
  17. Fisac, Víctor (2020-07-14), victorfisac/Physac, retrieved 2020-07-15
  18. Briemann, David Linus (2020-06-10), dbriemann/libpartikel, retrieved 2020-07-15
  19. WEREMSOFT (2020-06-27), WEREMSOFT/spine-raylib-runtimes, retrieved 2020-07-15
  20. WEREMSOFT (2020-07-12), WEREMSOFT/c99-raylib-cimgui-template, retrieved 2020-07-15
  21. "Google Open Source Peer Bonus winners are here!". Google Open Source Blog. Retrieved 2020-07-15.
  22. "RayLib receives an Epic MegaGrant". GameFromScratch.com. 2020-08-07. Retrieved 2020-08-10.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.