From 3c30e3f91971c5b6289c47f596016de46c06b5ca Mon Sep 17 00:00:00 2001 From: 4bb4 <67376761+4bb4@users.noreply.github.com> Date: Sun, 14 Mar 2021 20:53:07 +0100 Subject: [PATCH] Fixed conversions --- implot-examples/implot-glium-demo/Cargo.lock | 5 ++--- src/plot.rs | 8 ++++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/implot-examples/implot-glium-demo/Cargo.lock b/implot-examples/implot-glium-demo/Cargo.lock index 99c4605..adf198c 100644 --- a/implot-examples/implot-glium-demo/Cargo.lock +++ b/implot-examples/implot-glium-demo/Cargo.lock @@ -650,12 +650,11 @@ dependencies = [ [[package]] name = "implot" -version = "0.3.0" +version = "0.4.0" dependencies = [ "bitflags", "imgui", "implot-sys", - "lazy_static", "parking_lot", "rustversion", ] @@ -678,7 +677,7 @@ dependencies = [ [[package]] name = "implot-sys" -version = "0.3.0" +version = "0.4.0" dependencies = [ "cc", "imgui-sys", diff --git a/src/plot.rs b/src/plot.rs index 4dd748d..3e28aea 100644 --- a/src/plot.rs +++ b/src/plot.rs @@ -85,7 +85,7 @@ bitflags! { /// let plotting_context = implot::Context::create(); /// let plot_ui = plotting_context.get_plot_ui(); /// 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, || { /// // Do things such as plotting lines /// }); @@ -419,11 +419,15 @@ impl Plot { self.maybe_set_tick_labels(); let should_render = unsafe { + let size_vec: ImVec2 = ImVec2 { + x: self.size[0], + y: self.size[1], + }; sys::ImPlot_BeginPlot( self.title.as_ptr(), self.x_label.as_ptr(), self.y_label.as_ptr(), - self.size.into(), + size_vec, self.plot_flags, self.x_flags, self.y_flags[0],