Raylib 6.0 发布
摘要
Raylib 6.0 作为一款轻量级、无依赖的 C 语言游戏开发库发布,支持多平台与多个 OpenGL 版本。
查看缓存全文
缓存时间: 2026/04/23 13:52
raysan5/raylib 源码:https://github.com/raysan5/raylib
raylib 是一个简单、易用的库,让你享受游戏编程的乐趣。
raylib 深受 Borland BGI 图形库与 XNA 框架启发,特别适合原型开发、工具编写、图形应用、嵌入式系统及教学场景。
给冒险者的提示:raylib 是让你“纯写代码”的游戏编程库;没有花哨界面、没有可视化助手、没有调试按钮……只有最纯粹的斯巴达式编程体验。
准备开写?直接跳转到示例代码!(https://www.raylib.com/examples.html)
GitHub 发行版下载(https://github.com/raysan5/raylib/releases)
GitHub Star(https://github.com/raysan5/raylib/stargazers)
GitHub 自标签版本以来的提交(https://github.com/raysan5/raylib/commits/master)
GitHub 赞助(https://github.com/sponsors/raysan5)
打包状态(https://repology.org/project/raylib/versions)
许可证
Discord 成员(https://discord.gg/raylib)
Reddit 静态徽章(https://www.reddit.com/r/raylib/)
YouTube 订阅(https://www.youtube.com/c/raylib)
Twitch 状态(https://www.twitch.tv/raysan5)
Windows 构建(https://github.com/raysan5/raylib/actions/workflows/build_windows.yml)
Linux 构建(https://github.com/raysan5/raylib/actions/workflows/build_linux.yml)
macOS 构建(https://github.com/raysan5/raylib/actions/workflows/build_macos.yml)
WebAssembly 构建(https://github.com/raysan5/raylib/actions/workflows/build_webassembly.yml)
CMake 构建(https://github.com/raysan5/raylib/actions/workflows/build_cmake.yml)
Windows 示例构建(https://github.com/raysan5/raylib/actions/workflows/build_examples_windows.yml)
Linux 示例构建(https://github.com/raysan5/raylib/actions/workflows/build_examples_linux.yml)
功能
- 零外部依赖,所有必需库都已内置(https://github.com/raysan5/raylib/tree/master/src/external)
- 多平台支持:Windows、Linux、macOS、RPI、Android、HTML5……还有更多!
- 纯 C 代码(C99),采用 PascalCase/camelCase 命名风格
- 硬件加速 OpenGL:1.1、2.1、3.3、4.3、ES 2.0、ES 3.0
- 独有的 OpenGL 抽象层(可独立使用):rlgl(https://github.com/raysan5/raylib/blob/master/src/rlgl.h)
- 软件渲染后端(无需 OpenGL):rlsw(https://github.com/raysan5/raylib/blob/master/src/external/rlsw.h)
- 支持多种字体格式(TTF、OTF、FNT、BDF、精灵字体)
- 支持多种纹理格式,含压缩格式(DXT、ETC、ASTC)
- 完整 3D 支持,包含 3D 形状、模型、Billboard、高度图等!
- 灵活材质系统,支持经典贴图与PBR 贴图
- 支持骨骼动画的 3D 模型(IQM、M3D、glTF)
- 支持着色器,含模型着色器与后处理着色器
- 强大的数学模块,提供向量、矩阵、四元数运算:raymath(https://github.com/raysan5/raylib/blob/master/src/raymath.h)
- 音频加载与播放,支持流式(WAV、QOA、OGG、MP3、FLAC、XM、MOD)
- VR 立体渲染支持,可配置 HMD 设备参数
- 超 140 个示例代码的庞大合集(https://github.com/raysan5/raylib/tree/master/examples)!
- 支持 70+ 种编程语言绑定(https://github.com/raysan5/raylib/blob/master/BINDINGS.md)!
- 完全免费且开源
基础示例
下面是一个最简 raylib 示例:创建窗口并在屏幕中央绘制文字 "Congrats! You created your first window!"。
可在此在线运行(https://www.raylib.com/examples/core/loader.html?name=core_basic_window)。
#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;
}
构建与安装
Windows、Linux、macOS、Android 与 HTML5 的二进制发行版可在 GitHub Releases(https://github.com/raysan5/raylib/releases)获取。
raylib 也被众多操作系统的包管理器收录。
多平台安装与编译
raylib Wiki(https://github.com/raysan5/raylib/wiki#development-platforms)提供详细构建与使用指南:
- Windows 开发(https://github.com/raysan5/raylib/wiki/Working-on-Windows)
- macOS 开发(https://github.com/raysan5/raylib/wiki/Working-on-macOS)
- GNU/Linux 开发(https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux)
- Chrome OS 开发(https://github.com/raysan5/raylib/wiki/Working-on-Chrome-OS)
- FreeBSD 开发(https://github.com/raysan5/raylib/wiki/Working-on-FreeBSD)
- Raspberry Pi 开发(https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi)
- Android 开发(https://github.com/raysan5/raylib/wiki/Working-for-Android)
- Web(HTML5)开发(https://github.com/raysan5/raylib/wiki/Working-for-Web-(HTML5))
- 任意平台用 CMake(https://github.com/raysan5/raylib/wiki/Working-with-CMake)
Wiki 开放编辑,如在构建过程中遇到问题,欢迎直接修改 Wiki 或提交相关 Issue。
用多款 IDE 配置 raylib
raylib 最初在 Windows 下用 Notepad++(https://notepad-plus-plus.org/)与 MinGW GCC(https://www.mingw-w64.org/)开发,但同样适用于其他 IDE。
projects 目录(https://github.com/raysan5/raylib/tree/master/projects)提供多款 IDE 的项目模板,可直接编译 raylib 与示例。
支持的 IDE 众多,部分模板可能需要更新。如发现模板问题或有改进建议,欢迎提 PR 或 Issue。
学习与文档
raylib 主张以示例(https://github.com/raysan5/raylib/tree/master/examples)为主要学习资料。
暂无标准 API 文档,但提供一份速查表(https://www.raylib.com/cheatsheet/cheatsheet.html),列出所有函数、简短说明、参数与返回值,直观易懂。
更多设计文档见 raylib GitHub Wiki(https://github.com/raysan5/raylib/wiki)。
相关链接:
- raylib 速查表(https://www.raylib.com/cheatsheet/cheatsheet.html)
- raylib 架构(https://github.com/raysan5/raylib/wiki/raylib-architecture)
- raylib 库设计(https://github.com/raysan5/raylib/wiki)
- raylib 示例合集(https://github.com/raysan5/raylib/tree/master/examples)
- raylib 游戏合集(https://github.com/raysan5/raylib-games)
联系方式与社区
raylib 已入驻多个平台,社区日益壮大。如果你用得开心,欢迎加入:
最活跃的是 Discord 服务器(https://discord.gg/raylib)!
- 官网:https://www.raylib.com
- Discord:https://discord.gg/raylib
- X:https://x.com/raysan5
- BlueSky:https://bsky.app/profile/raysan5.bsky.social
- Twitch:https://www.twitch.tv/raysan5
- Reddit:https://www.reddit.com/r/raylib
- Patreon:https://www.patreon.com/raylib
- YouTube:https://www.youtube.com/c/raylib
贡献者
许可证
raylib 采用未经修改的 zlib/libpng 许可证,OSI 认证的类 BSD 许可,可静态链接到闭源软件。
详见 LICENSE。
raylib 内部使用若干库进行窗口/图形/输入管理及文件格式支持,这些库已内置在 src/external(https://github.com/raysan5/raylib/tree/master/src/external)目录。
依赖许可证详情见 Wiki(https://github.com/raysan5/raylib/wiki/raylib-dependencies)。
相似文章
Zig ELF 链接器改进开发日志
新的 Zig ELF 链接器现在支持外部库和 C 源码的快速增量编译,在 x86_64 Linux 上能够实现毫秒级重建。
Common Lisp 可移植性库状态
Common Lisp 可移植性库的全面状态概览,展示了不同 Common Lisp 实现之间的兼容性百分比。
Raybeam
Raybeam 是一款新工具,可在 macOS 上提供更好的屏幕共享体验。
vllm-project/vllm v0.21.0rc1
vLLM v0.21.0rc1 是高性能大语言模型推理和服务库的预发布更新,主要功能包括针对吞吐量、量化以及硬件支持的优化。
Simdutf现在可以在没有libc++或libc++abi的情况下使用
Simdutf是一个快速的Unicode库,现在可以在不需要libc++或libc++abi的情况下使用,这使得它在嵌入式、WebAssembly和独立环境中更具可移植性。这一更改移除了Ghostty终端模拟器库中的最后一个libc++依赖。