Skip to content

Commit

Permalink
Merge pull request imgui-rs#372 from lizhaoxian/add-peek-chars-io
Browse files Browse the repository at this point in the history
Add support to peek chars via imgui rs io
  • Loading branch information
Gekkio authored Nov 6, 2020
2 parents 132c749 + 0dc4bed commit 20385f4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,11 @@ impl Io {
sys::ImGuiIO_ClearInputCharacters(self.raw_mut());
}
}
/// Peek character input buffer, return a copy of entire buffer
pub fn peek_input_characters(&self) -> String {
let c16_slice = self.input_queue_characters.as_slice();
String::from_utf16(c16_slice).unwrap()
}
pub fn update_delta_time(&mut self, delta: Duration) {
let delta_s = delta.as_secs() as f32 + delta.subsec_nanos() as f32 / 1_000_000_000.0;
if delta_s > 0.0 {
Expand Down

0 comments on commit 20385f4

Please sign in to comment.