aboutsummaryrefslogtreecommitdiff
path: root/src/widgets.rs
diff options
context:
space:
mode:
authorLibravatar Silas Bartha <silas@exvacuum.dev>2024-12-23 23:59:21 -0500
committerLibravatar Silas Bartha <silas@exvacuum.dev>2024-12-23 23:59:21 -0500
commit8076af0e4e9f89480de7dac6180ab400500bbf0a (patch)
tree3f1ef3d8ab96c35793b200175124ff5130c89ca0 /src/widgets.rs
parentf31bd7d82a92307a2141024262f6101f1f7e3071 (diff)
Updated Documentation, Bumped to Bevy 0.15HEADv0.2.0master
Diffstat (limited to 'src/widgets.rs')
-rw-r--r--src/widgets.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/widgets.rs b/src/widgets.rs
index c1e057f..959aa44 100644
--- a/src/widgets.rs
+++ b/src/widgets.rs
@@ -41,6 +41,7 @@ pub struct DialogBoxWidget {
}
impl DialogBoxWidget {
+ /// Constructs a new dialog box widget
pub fn new(character: Option<String>, text: Vec<(String, Style)>, speed: Duration) -> Self {
Self {
character,
@@ -54,10 +55,12 @@ impl DialogBoxWidget {
}
}
+ /// Sets the character speaking, or title of the dialog
pub fn set_character(&mut self, character: Option<String>) {
self.character = character
}
+ /// Sets the text contained inside the dialog box
pub fn set_text(&mut self, text: Vec<(String, Style)>) {
self.character_count = text.iter().fold(0, |count, (string, _)| count + string.graphemes(true).count());
self.text = text;
@@ -65,10 +68,12 @@ impl DialogBoxWidget {
self.last_character = Instant::now();
}
+ /// Gets whether all of this dialog box's text has been displayed yet
pub fn typewriter_complete(&self) -> bool {
self.character_count == 0 || self.typewriter_index >= self.character_count
}
+ /// Skips the typewriter effect, displaying all text in the dialog box
pub fn skip_typewriter(&mut self) {
self.typewriter_index = self.character_count;
}