raylib README

The project's README from github.com/raysan5/raylib. As one markdown file: README.md.

raylib is a simple and easy-to-use library to enjoy videogames programming.

raylib is highly inspired by Borland BGI graphics lib and by XNA framework and it's especially well suited for prototyping, tooling, graphical applications, embedded systems and education.

NOTE for ADVENTURERS: raylib is a programming library to enjoy videogames programming; no fancy interface, no visual helpers, no debug button... just coding in the most pure spartan-programmers way.

Ready to learn? Jump to code examples!



GitHub Releases Downloads GitHub Stars GitHub commits since tagged version GitHub Sponsors Packaging Status License

Discord Members Reddit Static Badge Youtube Subscribers Twitch Status

Build Windows Build Linux Build macOS Build WebAssembly

Build CMake Build examples Windows Build examples Linux

features

limitations

raylib presents some limitation by design for code simplicity, some forks, alternatives and samples are available to overcome most of them but it's up to the users to modify the library for their specific needs.

basic example

This is a basic raylib example, it creates a window and draws the text "Congrats! You created your first window!" in the middle of the screen. Check this example running live on web here.

#include "raylib.h"

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

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

    CloseWindow();

    return 0;
}

build and installation

raylib binary releases for Windows, Linux, macOS, Android and HTML5 are available at the Github Releases page.

raylib is also available via multiple package managers on multiple OS distributions.

Installing and building raylib on multiple platforms

raylib Wiki contains detailed instructions on building and usage on multiple platforms.

Note that the Wiki is open for edit, if you find some issues while building raylib for your target platform, feel free to edit the Wiki or open an issue related to it.

Setup raylib with multiple IDEs

raylib has been developed on Windows platform using Notepad++ and MinGW GCC compiler but it can be used with other IDEs on multiple platforms.

Projects directory contains several ready-to-use project templates to build raylib and code examples with multiple IDEs.

Note that there are lots of IDEs supported, some of the provided templates could require some review, so please, if you find some issue with a template or you think they could be improved, feel free to send a PR or open a related issue.

learning and docs

raylib is designed to be learned using the examples as the main reference. There is no standard API documentation but there is a cheatsheet containing all the functions available on the library a short description of each one of them, input parameters and result value names should be intuitive enough to understand how each function works.

Some additional documentation about raylib design can be found in raylib GitHub Wiki. Here are the relevant links:

contact and networks

raylib is present in several networks and raylib community is growing everyday. If you are using raylib and enjoying it, feel free to join us in any of these networks. The most active network is our Discord server! :)

contributors

license

raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check LICENSE for further details.

raylib uses internally some libraries for window/graphics/inputs management and also to support different file formats loading, all those libraries are embedded with and are available in src/external directory. Check raylib dependencies LICENSES on raylib Wiki for details.

raylib (raysan5/raylib)

Searching Database…

35.2K ·GitHub
这是什么?raylib 是一个简单易用的 C 语言库(C99),用于游戏开发,设计灵感来自 Borland BGI 和 XNA 框架——你只管写代码,窗口、图形、输入和音频都由它来处理。
那它是一个带编辑器的完整引擎,还是一个我写代码调用的库?它是一个纯粹的编程库,没有编辑器:没有花哨的界面,没有可视化辅助工具,也没有调试按钮——只有一套 C API,供你在自己的代码中调用。
我要怎么安装它?可以从 GitHub Releases 页面下载预编译的二进制文件,通过系统的包管理器安装,或者自己从源码编译;wiki 里有各个平台的安装指南和现成的 IDE 项目模板。
我需要先安装其他的库或 SDK 吗?不需要——raylib 没有任何外部依赖,窗口、OpenGL、输入、音频和文件格式加载所需的库全部打包在库里面。
等项目做深了以后,最大的坑有哪些?这是它的设计使然:只有一个窗口、一个 OpenGL 上下文(不支持多窗口),调整窗口大小或移动窗口会暂停渲染循环,RenderTexture 导出来是上下颠倒的,而且文本不支持从右到左书写、连字和 emoji。
它只能用来做游戏,还是也能做别的东西?它面向游戏开发,但官方也明确表示适合做原型、工具软件、图形应用、嵌入式系统和教学,它的 140 多个示例本身就相当于一门图形编程课程。
我做好的游戏实际能跑在哪些平台上?Windows、Linux、macOS、树莓派、Android 和浏览器里的 HTML5,另外像 Chrome OS 和 FreeBSD 这类平台在 wiki 的编译指南里也有覆盖。
我用它做的闭源游戏可以卖钱吗?可以——它用的是原封未动的 zlib/libpng 许可证,这是 OSI 认证的类 BSD 许可证,明确允许静态链接到闭源软件中。
它在只有集成显卡的旧笔记本上能跑吗?大概率可以:渲染最低只要 OpenGL 1.1,甚至还有一个软件渲染后端(rlsw),完全没有 OpenGL 也能工作。
我必须写 C 吗,还是可以用别的语言?raylib 本身是用纯 C99 写的,但它有 70 多种编程语言的绑定,所以你可以在很多生态中使用它——C API 仍然是最权威的官方接口。
既然没有 API 文档,我该怎么学它?这是有意为之的:raylib 的设计就是让你通过 140 多个代码示例来学习,另外还有一份速查表,列出每个函数的参数和返回值名称;更深入的设计说明放在 GitHub wiki 里。
它能直接加载哪些媒体格式?字体:TTF、OTF、FNT、BDF 和位图字体;纹理,包括压缩的 DXT、ETC 和 ASTC;3D 模型:IQM、M3D 和带骨骼动画的 glTF;音频:WAV、QOA、OGG、MP3、FLAC、XM 和 MOD,支持流式播放。
Creator
raysan5
Size
406.5 MB
Stars
35.2K
Age
12y
Commits · 90 Days