Use igTextUnformatted in Ui::text

We already have a slice so this is faster.
This commit is contained in:
Joonas Javanainen 2017-11-02 23:57:35 +02:00
parent 63ceb71d44
commit b31f649c19
No known key found for this signature in database
GPG Key ID: D39CCA5CB19B9179

View File

@ -469,9 +469,11 @@ impl<'ui> Ui<'ui> {
// Widgets // Widgets
impl<'ui> Ui<'ui> { impl<'ui> Ui<'ui> {
pub fn text<P: AsRef<ImStr>>(&self, text: P) { pub fn text<P: AsRef<ImStr>>(&self, text: P) {
// TODO: use igTextUnformatted let s = text.as_ref();
unsafe { unsafe {
imgui_sys::igText(fmt_ptr(), text.as_ref().as_ptr()); let start = s.as_ptr();
let end = start.offset(s.len() as isize);
imgui_sys::igTextUnformatted(start as *const c_char, end as *const c_char);
} }
} }
pub fn text_colored<'p, A>(&self, col: A, text: &'p ImStr) pub fn text_colored<'p, A>(&self, col: A, text: &'p ImStr)