[游戏引擎对比](https://bloomengine.dev/zh-Hans/compare)

# 将一个 raylib 游戏迁移到 TypeScript

如果你需要 raylib 本身，可以尝试社区提供的绑定。如果一个独立的 TypeScript API，具备相似的绘制循环、PBR 和 Jolt 功能，符合你的目标，那么可以尝试 Bloom。[\[6\]](https://github.com/raysan5/raylib/tree/6.2 "来源 6 · 最后检查时间 2026-12-02")[\[1\]](https://github.com/Bloom-Engine/engine/tree/3cde2788 "来源 1 · 最后检查时间 2026-12-02")

最后检查时间 2026年12月2日

| 项目 | Bloom Engine | raylib |
| --- | --- | --- |
| 游戏开发语言 | TypeScript[\[1\]](https://github.com/Bloom-Engine/engine/tree/3cde2788 "来源 1 · 最后检查时间 2026-12-02") | C99[\[6\]](https://github.com/raysan5/raylib/tree/6.2 "来源 6 · 最后检查时间 2026-12-02") |
| 引擎许可证 | MIT[\[1\]](https://github.com/Bloom-Engine/engine/tree/3cde2788 "来源 1 · 最后检查时间 2026-12-02") | zlib/libpng[\[6\]](https://github.com/raysan5/raylib/tree/6.2 "来源 6 · 最后检查时间 2026-12-02") |
| 当前版本 | 0.4.19[\[2\]](https://registry.npmjs.org/@bloomengine/engine/latest "来源 2 · 最后检查时间 2026-12-02") | 6.2[\[8\]](https://github.com/raysan5/raylib/releases/tag/6.2 "来源 8 · 最后检查时间 2026-12-02") |
| 编辑器 | 独立的World Editor[\[3\]](https://github.com/Bloom-Engine/editor#status "来源 3 · 最后检查时间 2026-12-02") | 代码优先[\[7\]](https://www.raylib.com/ "来源 7 · 最后检查时间 2026-12-02") |
| 游戏目标平台 | macOS · Windows · Linux · iOS · tvOS · watchOS · visionOS · Android · Web[\[1\]](https://github.com/Bloom-Engine/engine/tree/3cde2788 "来源 1 · 最后检查时间 2026-12-02")[\[4\]](https://github.com/Bloom-Engine/engine/blob/3cde2788/docs/watchos-target.md "来源 4 · 最后检查时间 2026-12-02") | Windows、Linux、macOS、Android、Raspberry Pi、HTML5以及FreeBSD的构建指南[\[6\]](https://github.com/raysan5/raylib/tree/6.2 "来源 6 · 最后检查时间 2026-12-02") |
| 渲染 | wgpu · Metal · DX12 · Vulkan · OpenGL · WebGPU / WebGL · SwiftUI / SceneKit[\[1\]](https://github.com/Bloom-Engine/engine/tree/3cde2788 "来源 1 · 最后检查时间 2026-12-02")[\[4\]](https://github.com/Bloom-Engine/engine/blob/3cde2788/docs/watchos-target.md "来源 4 · 最后检查时间 2026-12-02") | OpenGL / OpenGL ES[\[6\]](https://github.com/raysan5/raylib/tree/6.2 "来源 6 · 最后检查时间 2026-12-02") |
| 物理 | 在支持的原生平台上使用Jolt。watchOS使用不同的后端。[\[1\]](https://github.com/Bloom-Engine/engine/tree/3cde2788 "来源 1 · 最后检查时间 2026-12-02")[\[4\]](https://github.com/Bloom-Engine/engine/blob/3cde2788/docs/watchos-target.md "来源 4 · 最后检查时间 2026-12-02") | 由游戏自行定义的碰撞与模拟[\[6\]](https://github.com/raysan5/raylib/tree/6.2 "来源 6 · 最后检查时间 2026-12-02") |
| 智能体工作方式 | 由Perry编译的TypeScript文件[\[1\]](https://github.com/Bloom-Engine/engine/tree/3cde2788 "来源 1 · 最后检查时间 2026-12-02") | 使用您的代码代理编辑源文件[\[6\]](https://github.com/raysan5/raylib/tree/6.2 "来源 6 · 最后检查时间 2026-12-02") |
| 价格 | 该引擎在其发布的许可下是免费的。[\[1\]](https://github.com/Bloom-Engine/engine/tree/3cde2788 "来源 1 · 最后检查时间 2026-12-02") | 该引擎在其发布的许可下是免费的。[\[6\]](https://github.com/raysan5/raylib/tree/6.2 "来源 6 · 最后检查时间 2026-12-02") |

该已发布赛车实验在此引擎中没有运行记录。 [阅读实验详情](https://bloomengine.dev/zh-Hans/blog/one-racing-game-six-ways) · [代码与日志](https://github.com/Bloom-Engine/racer-experiment)

## 移动精灵

精灵以每秒 120 个单位的速度右移，到达 640 时回到起点。 [下载 sprite.png](https://bloomengine.dev/compare/sprite.png)

### Bloom Engine

将 sprite.png 放在可执行文件旁边，并从该目录启动它。使用发布的引擎配合 Perry 和 Rust。[\[1\]](https://github.com/Bloom-Engine/engine/tree/3cde2788 "来源 1 · 最后检查时间 2026-12-02")[\[2\]](https://registry.npmjs.org/@bloomengine/engine/latest "来源 2 · 最后检查时间 2026-12-02")[\[3\]](https://github.com/Bloom-Engine/editor#status "来源 3 · 最后检查时间 2026-12-02")[\[4\]](https://github.com/Bloom-Engine/engine/blob/3cde2788/docs/watchos-target.md "来源 4 · 最后检查时间 2026-12-02")

main.ts

```
import { initWindow, runGame, clearBackground, Colors } from "@bloomengine/engine";
import { loadTexture, drawTexture } from "@bloomengine/engine/textures";

initWindow(640, 360, "Bloom");
const sprite = loadTexture("sprite.png");
let x = 0;
runGame((dt) => {
  x = (x + 120 * dt) % 640;
  clearBackground(Colors.BLACK);
  drawTexture(sprite, Math.floor(x), 180, Colors.WHITE);
});
```

### raylib

使用 raylib 编译，并从包含 sprite.png 的目录运行。[\[6\]](https://github.com/raysan5/raylib/tree/6.2 "来源 6 · 最后检查时间 2026-12-02")[\[7\]](https://www.raylib.com/ "来源 7 · 最后检查时间 2026-12-02")[\[1\]](https://github.com/Bloom-Engine/engine/tree/3cde2788 "来源 1 · 最后检查时间 2026-12-02")

main.c

```
#include <raylib.h>
#include <math.h>

int main(void) {
    InitWindow(640, 360, "raylib");
    Texture2D sprite = LoadTexture("sprite.png");
    float x = 0;
    SetTargetFPS(60);
    while (!WindowShouldClose()) {
        x = fmodf(x + 120 * GetFrameTime(), 640);
        BeginDrawing();
        ClearBackground(BLACK);
        DrawTexture(sprite, (int)x, 180, WHITE);
        EndDrawing();
    }
    UnloadTexture(sprite);
    CloseWindow();
    return 0;
}
```

## 适合选择 Bloom 的情况

你希望拥有熟悉的绘制循环（draw loop），并集成 3D 物理与原生 Apple 移动或电视端目标。[\[1\]](https://github.com/Bloom-Engine/engine/tree/3cde2788 "来源 1 · 最后检查时间 2026-12-02")[\[2\]](https://registry.npmjs.org/@bloomengine/engine/latest "来源 2 · 最后检查时间 2026-12-02")[\[3\]](https://github.com/Bloom-Engine/editor#status "来源 3 · 最后检查时间 2026-12-02")[\[4\]](https://github.com/Bloom-Engine/engine/blob/3cde2788/docs/watchos-target.md "来源 4 · 最后检查时间 2026-12-02")

## 适合选择 raylib 的情况

你希望拥有简洁的 C 示例、对游戏循环的直接控制，或在 Raspberry Pi 上构建项目。[\[6\]](https://github.com/raysan5/raylib/tree/6.2 "来源 6 · 最后检查时间 2026-12-02")[\[7\]](https://www.raylib.com/ "来源 7 · 最后检查时间 2026-12-02")[\[1\]](https://github.com/Bloom-Engine/engine/tree/3cde2788 "来源 1 · 最后检查时间 2026-12-02")

## 迁移说明

先移植一个帧循环，核对时间单位、输入轮询以及纹理的加载和释放，再对比输出，之后再迁移其他系统。[\[6\]](https://github.com/raysan5/raylib/tree/6.2 "来源 6 · 最后检查时间 2026-12-02")[\[7\]](https://www.raylib.com/ "来源 7 · 最后检查时间 2026-12-02")[\[1\]](https://github.com/Bloom-Engine/engine/tree/3cde2788 "来源 1 · 最后检查时间 2026-12-02")

## 常见问题解答

### Bloom 是 raylib 的移植版本吗？

Bloom 明确表示 API 设计借鉴了 raylib，渲染器和运行时则自行实现。建议先移植一个小型游戏循环。[\[6\]](https://github.com/raysan5/raylib/tree/6.2 "来源 6 · 最后检查时间 2026-12-02")[\[7\]](https://www.raylib.com/ "来源 7 · 最后检查时间 2026-12-02")[\[1\]](https://github.com/Bloom-Engine/engine/tree/3cde2788 "来源 1 · 最后检查时间 2026-12-02")

### 使用 raylib 要花多少钱？

该引擎在其发布的许可下是免费的。[\[6\]](https://github.com/raysan5/raylib/tree/6.2 "来源 6 · 最后检查时间 2026-12-02")

### 在迁移到Bloom时，我可以复用什么内容？

保留帧循环和艺术资源。翻译处理函数与调用，验证纹理生命周期和碰撞行为。Bloom 是一个受 raylib 启发的独立实现。[\[6\]](https://github.com/raysan5/raylib/tree/6.2 "来源 6 · 最后检查时间 2026-12-02")[\[7\]](https://www.raylib.com/ "来源 7 · 最后检查时间 2026-12-02")[\[1\]](https://github.com/Bloom-Engine/engine/tree/3cde2788 "来源 1 · 最后检查时间 2026-12-02")

### 哪些Bloom的限制对这个决策有影响？

Bloom 处于预览阶段，发布的包版本为 0.4.19。构建需要 Perry 和 Rust。生态较小，游戏逻辑以代码编写。独立的 World Editor 支持地形编辑和实体放置，预制件创作功能尚未完成。 Bloom 未内置通用可视化玩法编辑器。[\[1\]](https://github.com/Bloom-Engine/engine/tree/3cde2788 "来源 1 · 最后检查时间 2026-12-02")[\[2\]](https://registry.npmjs.org/@bloomengine/engine/latest "来源 2 · 最后检查时间 2026-12-02")[\[3\]](https://github.com/Bloom-Engine/editor#status "来源 3 · 最后检查时间 2026-12-02")[\[4\]](https://github.com/Bloom-Engine/engine/blob/3cde2788/docs/watchos-target.md "来源 4 · 最后检查时间 2026-12-02")

[Bloom 和 raylib 如何选择？](https://bloomengine.dev/zh-Hans/compare/raylib)

## 源代码

最后检查时间 2026年12月2日

1.  [github.com /Bloom-Engine/engine/tree/3cde2788](https://github.com/Bloom-Engine/engine/tree/3cde2788)
2.  [registry.npmjs.org /@bloomengine/engine/latest](https://registry.npmjs.org/@bloomengine/engine/latest)
3.  [github.com /Bloom-Engine/editor](https://github.com/Bloom-Engine/editor#status)
4.  [github.com /Bloom-Engine/engine/blob/3cde2788/docs/watchos-target.md](https://github.com/Bloom-Engine/engine/blob/3cde2788/docs/watchos-target.md)
5.  [apps.apple.com /us/app/bloom-jump/id6761447092](https://apps.apple.com/us/app/bloom-jump/id6761447092)
6.  [github.com /raysan5/raylib/tree/6.2](https://github.com/raysan5/raylib/tree/6.2)
7.  [raylib.com](https://www.raylib.com/)
8.  [github.com /raysan5/raylib/releases/tag/6.2](https://github.com/raysan5/raylib/releases/tag/6.2)

[Markdown](https://bloomengine.dev/zh-Hans/alternatives/raylib-typescript.md)
