1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#![warn(missing_docs)]
#![warn(missing_doc_code_examples)]

//! ![Rust](https://github.com/tjhaskel/rust_intfic/workflows/Rust/badge.svg)
//! 
//! intfic is a framework that allows you to write a branching story with minimal code.
//! 
//! It uses story files with a custom markup syntax that allows for the following:
//! 
//! * Write text or specific quotes of text with different colors
//! * Display options that trigger different Story Blocks or Story Files
//! * Set flags or add to counters in the GameState
//! * Check flags or counters in the GameState and conditionally display text or options
//! 
//! Additionally, I've included some basic functions for asking yes-no questions and traveling in the cardinal directions, should you prefer to take a more "text adventure" approach with code.
//! 
//! ![splash](https://raw.githubusercontent.com/tjhaskel/rust_intfic/master/resources/option.png)
//! 
//! ## Getting Started
//! 
//! 1. Run the example with "cargo run"
//! 2. Examine the example story files and read up on the [intfic Story File Markup Specification](parse_file/index.html#story-file-markup-specification)
//! 3. Write you own story, and update main.rs to start it!
//! 
//! ## License
//! 
//! This project is licensed under the MIT License - see the [LICENSE.md](https://github.com/tjhaskel/rust_intfic/blob/master/LICENSE.md) file for details 

use std::time;

/// Stores, saves, and loads an environment that can be changed and referenced by your story.
pub mod game_state;

/// Parses story files and constructs a list of StoryBlock's.
pub mod parse_file;

/// Sanitizes and parses input, checking for system keywords.
pub mod parse_input;

/// Represents an atomic chunk of story with text, effects, and options.
pub mod story_block;

/// Writes text with a typewriter effect and a variety of possible colors.
pub mod write_out;

#[cfg(test)]
mod tests;

/// If enabled, various debug info will be printed during gameplay
pub const DEBUG: bool = true;

/// If enabled, the typewriter effect of write_out is made instantaneous.
pub const FASTMODE: bool = true;

/// The base amount of time before the next line of a block is started, if FASTMODE is disabled.
pub const LINETIME: time::Duration = time::Duration::from_millis(1200);

/// The base amount of time before the next charater of a line is typed, if FASTMODE is disabled.
pub const TYPETIME: time::Duration = time::Duration::from_millis(24);

/// Prints a string if DEBUG is enabled.
pub fn print_debug(to_print: String) {
    if DEBUG {
        println!("{}", to_print);
    }
}