Fixed conversions

This commit is contained in:
4bb4 2021-03-14 20:53:07 +01:00
parent 40766c3435
commit 3c30e3f919
2 changed files with 8 additions and 5 deletions

View file

@ -650,12 +650,11 @@ dependencies = [
[[package]] [[package]]
name = "implot" name = "implot"
version = "0.3.0" version = "0.4.0"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"imgui", "imgui",
"implot-sys", "implot-sys",
"lazy_static",
"parking_lot", "parking_lot",
"rustversion", "rustversion",
] ]
@ -678,7 +677,7 @@ dependencies = [
[[package]] [[package]]
name = "implot-sys" name = "implot-sys"
version = "0.3.0" version = "0.4.0"
dependencies = [ dependencies = [
"cc", "cc",
"imgui-sys", "imgui-sys",

View file

@ -85,7 +85,7 @@ bitflags! {
/// let plotting_context = implot::Context::create(); /// let plotting_context = implot::Context::create();
/// let plot_ui = plotting_context.get_plot_ui(); /// let plot_ui = plotting_context.get_plot_ui();
/// implot::Plot::new("my title") /// implot::Plot::new("my title")
/// .size(300.0, 200.0) // other things such as .x_label("some_label") can be added too /// .size([300.0, 200.0]) // other things such as .x_label("some_label") can be added too
/// .build(&plot_ui, || { /// .build(&plot_ui, || {
/// // Do things such as plotting lines /// // Do things such as plotting lines
/// }); /// });
@ -419,11 +419,15 @@ impl Plot {
self.maybe_set_tick_labels(); self.maybe_set_tick_labels();
let should_render = unsafe { let should_render = unsafe {
let size_vec: ImVec2 = ImVec2 {
x: self.size[0],
y: self.size[1],
};
sys::ImPlot_BeginPlot( sys::ImPlot_BeginPlot(
self.title.as_ptr(), self.title.as_ptr(),
self.x_label.as_ptr(), self.x_label.as_ptr(),
self.y_label.as_ptr(), self.y_label.as_ptr(),
self.size.into(), size_vec,
self.plot_flags, self.plot_flags,
self.x_flags, self.x_flags,
self.y_flags[0], self.y_flags[0],