Skip to content

Commit 832cbec

Browse files
committed
Add current_split_index
1 parent 15ad01f commit 832cbec

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/runtime/sys.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ extern "C" {
7979
pub fn timer_undo_split();
8080
/// Resets the timer.
8181
pub fn timer_reset();
82+
/// Accesses the index of the split the attempt is currently on. If there's
83+
/// no attempt in progress, `-1` is returned instead. This returns an
84+
/// index that is equal to the amount of segments when the attempt is
85+
/// finished, but has not been reset. So you need to be careful when using
86+
/// this value for indexing.
87+
pub fn timer_current_split_index() -> i32;
8288
/// Sets a custom key value pair. This may be arbitrary information that the
8389
/// auto splitter wants to provide for visualization. The pointers need to
8490
/// point to valid UTF-8 encoded text with the respective given length.

src/runtime/timer.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,15 @@ pub fn state() -> TimerState {
112112
}
113113
}
114114

115+
/// Accesses the index of the split the attempt is currently on. If there's
116+
/// no attempt in progress, `-1` is returned instead. This returns an
117+
/// index that is equal to the amount of segments when the attempt is
118+
/// finished, but has not been reset. So you need to be careful when using
119+
/// this value for indexing.
120+
pub fn current_split_index() -> i32 {
121+
unsafe { sys::timer_current_split_index() }
122+
}
123+
115124
/// Sets the game time.
116125
#[inline]
117126
pub fn set_game_time(time: time::Duration) {

0 commit comments

Comments
 (0)