raylib

repository·master·Indexed 12 days ago

https://github.com/raysan5/raylib

A simple, easy-to-use C library for videogame programming, prototyping, and educational purposes. Hardware-accelerated via OpenGL, it provides a code-centric approach to rendering shapes, textures, 3D models, and text, as well as handling audio and shaders. It supports multiple build systems including GNU make, Zig, Meson, and CMake, and is compatible with desktop and web platforms via Emscripten.

Tokens
9.1K
Snippets
27
Records
57
Agent score
97%

What's inside raylib

  1. Explore raylib Audio examples

    master
    The audio category contains 10 examples demonstrating the functionality of the raudio module. These examples cover sound and music loading, streaming (both music and raw streams), audio effects, spatial sound positioning, and spectrum visualization. Note that the raudio module can be used as a standalone component independently of the main raylib library.
  2. Explore raylib core examples

    master

    The core category contains 49 examples demonstrating the fundamental functionality of the raylib rcore.c module. These examples cover essential platform features including:

    • Window Management: Window creation, flags, letterboxing, and HighDPI support.
    • Input Handling: Keyboard, mouse (including wheel), gamepad, multitouch, gestures, and virtual controls.
    • Camera Systems: 2D cameras (including zoom and split-screen) and 3D cameras (free, first-person, FPS, and split-screen).
    • System & Platform: Delta time, monitor detection, custom logging, file/directory handling, clipboard text, and screen recording.
    • Rendering & Math: Scissor testing, render textures, viewport scaling, random values, and compute hashes.
    • Game Logic Patterns: Screen managers, undo/redo systems, and input action mapping.
  3. Use `rexm` to manage raylib examples

    master

    rexm is a command-line tool designed to automate the management of the raylib examples collection. It handles the complex process of adding, renaming, removing, validating, and building examples across multiple platforms (Desktop and Web) and build systems (Makefiles, Visual Studio, and raylib.com web assets).

    Use rexm to ensure your new or modified examples follow the required metadata structure, include necessary resources, and are correctly registered in all raylib build configurations and documentation.

    rexm help
  4. Use rlparser to extract raylib API information

    master

    The rlparser tool scans C header files (specifically raylib.h) to extract metadata about defines, structs, enums, and functions. The extracted data is organized into the following structures:

    • struct DefineInfo
    • struct FunctionInfo
    • struct StructInfo
    • struct EnumInfo

    This tool is useful for generating documentation or metadata files in formats like JSON, XML, or LUA from the raw C header source.

  5. Explore raylib Shaders examples

    master
    The shaders category contains 49 examples demonstrating various GPU programming techniques using raylib. These range from basic lighting and texture rendering to advanced topics like deferred rendering, PBR (Physically Based Rendering), raymarching, and compute shaders via rlgl.
  6. Explore raylib shapes examples

    master
    The shapes category contains 40 examples demonstrating the drawing functionality provided by the raylib rshapes.c module. Use these examples to learn how to render various geometric primitives and shapes within your applications.
  7. What is raylib and how does it differ from an engine?

    master

    raylib is a C programming library designed for graphics/multimedia applications. It is considered a graphics library with high-level features rather than a full game engine.

    Unlike engines like Unity, Unreal, or Godot, raylib does not provide:

    • A Screen manager
    • A GameObject/Entity manager
    • A Resource Manager

    It provides full control at a low level, allowing users to build applications in a 'handmade' way without the abstraction of a GUI editor or complex integrated tools.

  8. Header file formatting constraints for rlparser

    master

    While rlparser can work with other C headers, they must follow specific structural patterns to be parsed correctly:

    Functions

    Must be on a single line with this structure: <retType> <name>(<paramType[0]> <paramName[0]>, <paramType[1]> <paramName[1]>); <desc> Warning: Breaking functions into multiple lines will break the parsing process.

    Structures

    Must follow this multi-line format:

    <desc>
    typedef struct <name> {
        <fieldType[0]> <fieldName[0]>; <fieldDesc[0]>
        <fieldType[1]> <fieldName[1]>; <fieldDesc[1]>
    } <name>;

    Enums

    Must follow this multi-line format:

    <desc>
    typedef enum {
        <valueName[0]> = <valueInteger[0]>, <valueDesc[0]>
        <valueName[1]>, 
        <valueName[2]>, <valueDesc[2]>
    } <name>;

    Enum Rules:

    • If a value is not provided, it is assigned as (<previous_value> + 1).
    • Value descriptions are optional.
  9. raylib license and usage

    master
    The raylib source code is licensed under an unmodified zlib/libpng license. This is an OSI-certified, BSD-like license that allows for static linking with closed-source software. You can use raylib for free to create games, tools, or applications, and you are also free to modify or adapt the source code.
  10. Understand the modified GLFW used in raylib

    master

    raylib uses a modified version of GLFW to ensure compatibility across different platforms. The primary modification involves renaming specific static functions that share names across different platforms, allowing all GLFW source files to be combined into a single file (typically rglfw.c). Additionally, the 'Null' platform is disabled as it is not required by raylib.

    If you are inspecting the source or debugging platform-specific behavior, note that the following functions have been renamed from their original GLFW names to avoid collisions:

    /* Renamed functions in the raylib GLFW modification: */
    - createKeyTables()
    - translateKey()
    - acquireMonitor()
    - releaseMonitor()