#dialog #gamedev #game

dialogos

为 Rust 开发的超简单对话系统

2 个版本

0.1.1 2022 年 9 月 14 日
0.1.0 2022 年 9 月 14 日

#1120 in 游戏开发

MIT 许可证

13KB
232

📝 Dialogos

为 Rust 开发的超简单对话系统。

它并不特别,这正是它的优势!它只是能够正常工作。这个库非常适合用于游戏 jams(游戏马拉松)制作的简单游戏。对于更复杂的游戏,我建议扩展 Dialogos 或使用其他工具。

🌽 特点

  • 易于使用
  • 标签
  • 菜单
  • 变量
  • 数学运算
  • 条件语句

🍄 安装

将 Dialogos 添加为 Cargo.toml 的依赖项

[dependencies]
dialogos = { git = "https://github.com/AlexandrosKap/dialogos" }

然后使用以下命令打开文档

cargo doc --open

🍅 示例

一个 Hello World 示例

use dialogos::*;

fn main() {
    let alex = |cont| text("Alex", cont);

    let mut d = Dialogue::new(vec![
        alex("Hello world."),
        alex("Something something."),
        alex("The end."),
    ]);

    while !d.has_end() {
        let line = d.line();
        println!("{}: {}", line.info, line.cont);
        d.next();
    }
}

依赖项

~2.2–3MB
~53K SLoC