百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
E

emerald

> 编程语言
开源

一个专注于可移植性的 2D Rust 游戏引擎。

550 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

一个专注于可移植性的 2D Rust 游戏引擎。

The Cross Platform Engine

Emerald is designed to be as lightweight as possible, while remaining a fully-featured and cross-platform game engine.

The api is simple and powerful, giving you direct access to physics, audio, graphics, game worlds, and asset loading.

Supported Platforms

--- Work in progress ---


Asset Loading

rust
let my_sprite = emd.loader()
    .sprite("my_sprite.png")
    .unwrap();

let my_audio = emd.loader()
    .sound("my_sound.wav")
    .unwrap();

Physics

Creating Bodies

rust
    let entity = emd.world().spawn((Transform::from_translation((0.0, 0.0))));

    let body_handle = emd.world().physics().build_body(
        entity,
        RigidBodyBuilder::dynamic()
    );

    emd.world().physics().build_collider(
        body_handle,
        ColliderDesc::cuboid(6.0, 6.0)
    );

    // You can alternatively build both the entity and body at once.
    let (entity, body_handle) = emd.world()
        .spawn_with_body(
            (Transform::from_translation((0.0, 0.0))),
            RigidBodyBuilder::dynamic()
        )?;

Physics Stepping

rust

    emd.world()
        .physics()
        .step();

You decide when physics steps! This makes it very easy to "pause" the game without needing to alter any data.

Graphics

The default method to draw the game is to draw all of the entities in the current world. However, you can write your own draw function if you need to do more!

rust
fn draw(&mut self, mut emd: Emerald) {
    emd.graphics().begin();

    emd.graphics().draw_world();

    emd.graphics().render();
}

Audio

rust
let my_sound = emd.loader().sound("sounds/my_song.ogg")?;

emd.audio().mixer("background_music")?.play_and_loop(my_sound);

ECS

Emerald uses the Entity Component System paradigm for creating, managing, and updating game entities.

Emerald uses Hecs under the hood for fast entity iteration, and a remarkably clean query Api.

More detailed features can be found in the Hecs documentation.

rust
for (id, (sprite, mut position)) in emd.world().query::().iter() {
    position.x += 10.0;
}

Aseprite

Emerald has built in aseprite loading and rendering. Simply load in the file, then tell it which animations to play.

rust
let mut aseprite = emd.loader().aseprite("my_sprite.aseprite").unwrap();

aseprite.play("some_aseprite_animation");

emd.world().spawn((aseprite, Position::zero()));

Alternatively, Emerald can load a sprite sheet exported from aseprite.

rust
let mut aseprite = emd.loader()
    .aseprite_with_animations("my_texture.png", "my_animation.json").unwrap();

Export settings

WASM (WIP, PROBABLY BROKEN RIGHT NOW)

Build

cargo build --target wasm32-unknown-unknown

Asset Loading

In order to keep a clean, simple API, and avoid network requests for assets. Emerald takes the approach of packing all necessary assets into the WASM binary.

This same method can be used to pack all assets into the game binary regardless of which platform you target.

Use the pack_asset_bytes function to load data into the engine.

…

Android (WIP, PROBABLY BROKEN RIGHT NOW)

Asset Loading

Add following to Cargo.toml and load assets as usual:

[package.metadata.android]
assets = "YOUR_ASSETS_DIRECTORY/"

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rust2dgame-developmentgame-enginegamedev

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言