and added the thorn in this method

This commit is contained in:
Jack Mac 2021-09-26 21:11:39 -04:00
parent 1d15196b5e
commit 41ab364384
2 changed files with 14 additions and 22 deletions

View File

@ -10,8 +10,8 @@ use crate::clipboard::{ClipboardBackend, ClipboardContext};
use crate::fonts::atlas::{FontAtlas, FontAtlasRefMut, FontId, SharedFontAtlas};
use crate::io::Io;
use crate::style::Style;
use crate::sys;
use crate::Ui;
use crate::{sys, DrawData};
/// An imgui-rs context.
///
@ -518,7 +518,6 @@ impl Context {
}
/// Starts a new frame.
#[deprecated(since = "0.9.0", note = "use `new_frame` instead")]
pub fn frame(&mut self) -> &mut Ui {
self.new_frame()
}
@ -547,4 +546,17 @@ impl Context {
&mut self.ui
}
/// Renders the frame and returns a reference to the resulting draw data.
///
/// This should only be called after calling [`new_frame`].
///
/// [`new_frame`]: Self::new_frame
#[doc(alias = "Render", alias = "GetDrawData")]
pub fn render(&mut self) -> &DrawData {
unsafe {
sys::igRender();
&*(sys::igGetDrawData() as *mut DrawData)
}
}
}

View File

@ -196,28 +196,8 @@ impl Ui {
pub fn clone_style(&self) -> Style {
unsafe { *self.style() }
}
// /// Renders the frame and returns a reference to the resulting draw data
// #[doc(alias = "Render", alias = "GetDrawData")]
// pub fn render(self) -> &DrawData {
// unsafe {
// sys::igRender();
// &*(sys::igGetDrawData() as *mut DrawData)
// }
// }
}
// TODO JACK YOU NEED TO MOVE THIS!
// impl Drop for Ui {
// #[doc(alias = "EndFrame")]
// fn drop(&mut self) {
// if !std::thread::panicking() {
// unsafe {
// sys::igEndFrame();
// }
// }
// }
// }
/// # Demo, debug, information
impl Ui {
/// Renders a demo window (previously called a test window), which demonstrates most