Crates.io | yarn-spool |
lib.rs | yarn-spool |
version | 0.1.0 |
source | src |
created_at | 2018-06-11 01:23:31.011837 |
updated_at | 2018-06-11 01:23:31.011837 |
description | A library for parsing and evaluating Yarn Dialogue scripts. |
homepage | |
repository | https://github.com/jdm/yarn-spool |
max_upload_size | |
id | 69549 |
size | 68,100 |
This is a library for parsing and evaluating Yarn Dialogue scripts in Rust games. It is designed to be embedded with game-provided hooks to affect the game state without making assumptions about how the dialogue will be displayed.
There are two main pieces:
YarnHandler
trait, which provides hooks for the dialogue engine to call back into the gameYarnEngine
type, which is responsible for parsing Yarn scripts and encapsulates the ongoing dialogue stateTo begin a dialogue, call the YarnEngine::activate
method. When it's time to move on from the current line of dialogue, call YarnEngine::proceed
. If a choice is required in order to proceed, call YarnEngine::choose
instead.
For an example of integrating yarn-spool into a game, look at the source of the example game.