Add infinite lines.

This commit is contained in:
silvana 2023-10-09 05:47:11 +02:00
parent fa23f04fae
commit ed1670604e

View file

@ -1,3 +1,5 @@
use sys::ImPlotInfLinesFlags__ImPlotInfLinesFlags_Horizontal;
use crate::sys; use crate::sys;
use std::ffi::CString; use std::ffi::CString;
use std::os::raw::c_char; use std::os::raw::c_char;
@ -35,6 +37,19 @@ impl PlotLine {
} }
} }
pub fn plot_inf(&self, x: f64) {
unsafe {
sys::ImPlot_PlotInfLines_doublePtr(
self.label.as_ptr() as *const c_char,
&x,
1,
ImPlotInfLinesFlags__ImPlotInfLinesFlags_Horizontal as i32,
0,
8, /* sizeof(double) */
);
}
}
pub fn plot(&self, x: &[f64], y: &[f64]) { pub fn plot(&self, x: &[f64], y: &[f64]) {
if x.len().min(y.len()) == 0 { if x.len().min(y.len()) == 0 {
return; return;