$ show raysan5/raylib
raylib is a cross-platform game development library written in C99, designed to provide a simple and easy-to-use API for creating games, prototypes, and multimedia applications. It abstracts away platform-specific details like window creation, input handling, and graphics rendering, offering a consistent interface across Windows, macOS, Linux, Android, and Web (via Emscripten). The library is modular, with core modules for shapes, textures, text, 3D models, audio, and shaders, all built on top of a low-level OpenGL abstraction layer (rlgl). It bundles its own windowing backend (a fork of GLFW) and includes numerous single-file external libraries for image loading (stb_image), audio decoding (dr_flac, dr_mp3, dr_wav, jar_mod, jar_xm), compression (sdefl, qoa, pep), and model loading (tinyobj_loader, cgltf, vox_loader). The repository contains over 200 example programs that serve as both documentation and test cases, covering everything from basic window creation to advanced shader effects and 3D rendering pipelines. The architecture follows a monolithic library pattern with a single public header (raylib.h) and several optional headers (raymath.h, rlgl.h, raygui.h). The core library is compiled from source files (rcore.c, rshapes.c, rtextures.c, rtext.c, rmodels.c, raudio.c) and platform-specific backends (rcore_desktop_glfw.c, rcore_android.c, rcore_web_emscripten.c, etc.). The library is designed to be self-contained, with no external runtime dependencies beyond the operating system's graphics drivers. Build system support includes CMake, Make, Zig, Meson, and IDE project files for Visual Studio, VSCode, CodeBlocks, and others. Key data flows involve initializing a window and graphics context, then entering a game loop where user input is polled, game state is updated, and rendering commands are issued. The library handles resource management (textures, fonts, models, audio streams) internally, with automatic cleanup on window close. The audio subsystem supports streaming, effects, and multi-channel playback. The shader system allows custom GLSL vertex and fragment shaders to be applied to 2D and 3D rendering. The library also includes utility modules for math (vectors, matrices, quaternions), easing functions, gesture recognition, and camera systems. External dependencies are minimal due to extensive bundling; the only required system libraries are OpenGL (or OpenGL ES on mobile/web) and the platform's native windowing/input APIs. The bundled GLFW fork provides a consistent windowing layer across platforms. The library is actively maintained with regular commits, CI builds for multiple platforms, and a large community of users and contributors.
The LLM identified 5 files worth highlighting for reuse:
Provides a complete 2D/3D camera system with target following, zoom, and screen shake effects. Designed with a RCAMERA_STANDALONE macro that allows it to be used independently of raylib core, making it a reusable component for any OpenGL-based project. Demonstrates clean separation of concerns and configurable behavior.
Implements touch gesture recognition (tap, double-tap, drag, pinch, swipe) with customizable thresholds. Like rcamera.h, it can be compiled standalone, providing a self-contained gesture processing engine that can be integrated into any project requiring touch input handling.
A comprehensive collection of Robert Penner's easing functions (quadratic, cubic, quartic, sine, exponential, elastic, bounce, etc.) implemented as a single-header library. Each function follows a consistent signature (float t, float b, float c, float d) and can be extracted and used in any animation or interpolation context without dependencies.
A header-only module that manages up to 4 lights for GLSL shader lighting. Provides CreateLight() and UpdateLightValues() functions that populate uniform arrays for position, color, and intensity. Used across multiple shader examples, it encapsulates the boilerplate of setting up lighting uniforms and can be reused in any raylib project using custom shaders.
A template file for implementing new platform backends in raylib. It defines the full interface (InitPlatform, ClosePlatform, PollInputEvents, SwapScreenBuffer, etc.) with stub implementations that log warnings. This pattern allows developers to add support for new platforms by filling in the stubs, demonstrating a clean platform abstraction layer.