mitiru::narrative

Visual-novel runtime: script VM, dialogue state, branching, choice resolution, and integration with the VN view layer.

Visual-novel runtime: script VM, dialogue state, branching, choice resolution, and integration with the VN view layer.

NameKindItems
TextScenestruct2
ImageScenestruct2
ChoiceOptionstruct2
ChoiceScenestruct1
WaitScenestruct1
SetFlagScenestruct2
StatChangeScenestruct2
Scriptstruct2
GameContextstruct2
ExecuteResultstruct1
ScriptRunnerclass19

Free functions and typedefs

using json = ::nlohmann::json;
`using Scene = std::variant<TextScene, ImageScene, ChoiceScene, WaitScene, SetFlagScene, StatChangeScene>;`
struct TextScene 2
std::string speaker
std::string text
struct ImageScene 2
std::string path
int durationMs = 0
struct ChoiceOption 2
std::string label
std::string next
struct ChoiceScene 1
std::vector<ChoiceOption> options
struct WaitScene 1
int ms = 0
struct SetFlagScene 2
std::string name
bool value = false
struct StatChangeScene 2
std::string stat
int delta = 0
struct Script 2
std::string id
std::vector<Scene> scenes
struct GameContext 2
std::unordered_map<std::string, bool> flags
std::unordered_map<std::string, int> stats
struct ExecuteResult 1
std::string chosenNext
class ScriptRunner 19
using TextFn = std::function<void(const std::string& speaker, const std::string& text)>;
using ImageFn = std::function<void(const std::string& path, int durationMs)>;
using ChoiceFn = std::function<std::string(const std::vector<std::string>& labels)>;
using WaitFn = std::function<void(int ms)>;
using FlagFn = std::function<void(const std::string& name, bool value)>;
using StatChangeFn = std::function<void(const std::string& stat, int delta, int newValue)>;
ScriptRunner() = default
void loadFromJson(std::string_view jsonText, std::string_view sourceLabel = "<inline>")
void loadFromDirectory(const std::filesystem::path& dir)
[[nodiscard]] const Script* findScript(std::string_view id) const
[[nodiscard]] std::size_t scriptCount() const noexcept
void clear() noexcept
void onTextDisplay(TextFn fn)
void onImageShow(ImageFn fn)
void onChoiceOffer(ChoiceFn fn)
void onWaitBegin(WaitFn fn)
void onFlagSet(FlagFn fn)
void onStatChange(StatChangeFn fn)
ExecuteResult execute(std::string_view scriptId, GameContext& ctx)

Sourced from docs/API_CATALOG.md, auto-generated by tools/generate_api_catalog.py.