Updated to newest available implot

This commit is contained in:
4bb4 2020-10-31 11:04:13 +01:00
parent b6a7cae830
commit af0996390a
6 changed files with 2507 additions and 200 deletions

View file

@ -4,8 +4,9 @@
Rust bindings for [ImPlot](https://github.com/epezent/implot), built by running
[bindgen](https://github.com/rust-lang/rust-bindgen) on [cimplot](https://github.com/cimgui/cimplot).
The bindings are currently based on ImPlot version 0.7. See the status section below for
detailed information on implementation status.
The bindings are currently based on ImPlot version 0.8-WIP (see
[implot-sys/third_party](implot-sys/third_party) for the exact commit currently pointed to).
The status section below provides detailed information on implementation status.
[![Docs.rs documentation](https://docs.rs/implot/badge.svg)](https://docs.rs/implot/)
![Tests](https://github.com/4bb4/implot-rs/workflows/Tests/badge.svg)
@ -46,6 +47,10 @@ is open to collaboration, if you'd like to help, feel free to reach out via a Gi
At this point, raw bindings are working in implot-sys, and more idiomatic interfaces
for plot creation as well a subset of the functionality for plots are implemented.
While the raw bindings have versions of most functions for different data types such as
32-bit or 64-bit floats and various integers, the higher-level bindings are currently only
created for 64-bit floats.
- [x] "BeginPlot"
- [x] Basic hello world
- [x] Plot flags
@ -65,11 +70,16 @@ for plot creation as well a subset of the functionality for plots are implemente
- [ ] Heatmap
- [ ] Pie chart
- [ ] Digital data
- [x] Plot customization
- [ ] Stairs plot
- [ ] Annotations
- [ ] Dragline
- [ ] Dragpoint
- [ ] Plot customization
- [x] Axis flags
- [x] Styling colors
- [x] Styling variables
- [x] Colormaps
- [ ] Legend locations
- [x] Plot querying
- [x] is hovered
- [x] mouse position in plot

File diff suppressed because it is too large Load diff

@ -1 +1 @@
Subproject commit 54ed676f42b7d96d6622f1c90df7d884246cc944
Subproject commit a7760f2f7557e15f50fe7916c9243b192345b38e

View file

@ -83,7 +83,7 @@ pub enum Marker {
/// Colorable plot elements. These are called "ImPlotCol" in ImPlot itself, but I found that
/// name somewhat confusing because we are not referring to colors, but _which_ thing can
/// be colored - hence I added the "Element".
#[repr(i32)]
#[repr(u32)]
#[derive(Copy, Clone, Debug)]
pub enum PlotColorElement {
/// Plot line/outline color (defaults to next unused color in current colormap)
@ -137,7 +137,7 @@ pub enum PlotColorElement {
}
/// Colormap choice. Documentation copied from implot.h for convenience.
#[repr(i32)]
#[repr(u32)]
#[derive(Copy, Clone, Debug)]
pub enum Colormap {
/// ImPlot default colormap (n=10). Called "Standard" here because Default is reserved.
@ -164,7 +164,7 @@ pub enum Colormap {
Jet = sys::ImPlotColormap__ImPlotColormap_Jet,
}
#[repr(i32)]
#[repr(u32)]
#[derive(Copy, Clone, Debug)]
pub enum StyleVar {
/// f32, line weight in pixels
@ -207,8 +207,16 @@ pub enum StyleVar {
LabelPadding = sys::ImPlotStyleVar__ImPlotStyleVar_LabelPadding,
/// ImVec2, legend padding from top-left of plot
LegendPadding = sys::ImPlotStyleVar__ImPlotStyleVar_LegendPadding,
/// ImVec2, legend inner padding from legend edges
LegendInnerPadding = sys::ImPlotStyleVar__ImPlotStyleVar_LegendInnerPadding,
/// ImVec2, spacing between legend entries
LegendSpacing = sys::ImPlotStyleVar__ImPlotStyleVar_LegendSpacing,
/// ImVec2, padding between plot edge and interior info text
InfoPadding = sys::ImPlotStyleVar__ImPlotStyleVar_InfoPadding,
MousePosPadding = sys::ImPlotStyleVar__ImPlotStyleVar_MousePosPadding,
/// ImVec2, text padding around annotation labels
AnnotationPadding = sys::ImPlotStyleVar__ImPlotStyleVar_AnnotationPadding,
/// ImVec2, default size used when ImVec2(0,0) is passed to BeginPlot
PlotDefaultSize = sys::ImPlotStyleVar__ImPlotStyleVar_PlotDefaultSize,
/// ImVec2, minimum size plot frame can be when shrunk
PlotMinSize = sys::ImPlotStyleVar__ImPlotStyleVar_PlotMinSize,
}

View file

@ -17,7 +17,7 @@ bitflags! {
/// convenience. ImPlot itself also has a "CanvasOnly" flag, which can be emulated here with
/// the combination of `NO_LEGEND`, `NO_MENUS`, `NO_BOX_SELECT` and `NO_MOUSE_POSITION`.
#[repr(transparent)]
pub struct PlotFlags: i32 {
pub struct PlotFlags: u32 {
/// "Default" according to original docs
const NONE = sys::ImPlotFlags__ImPlotFlags_None;
/// Plot items will not be highlighted when their legend entry is hovered
@ -51,7 +51,7 @@ bitflags! {
/// has `Lock`, which combines `LOCK_MIN` and `LOCK_MAX`, and `NoDecorations`, which combines
/// `NO_GRID_LINES`, `NO_TICK_MARKS` and `NO_TICK_LABELS`.
#[repr(transparent)]
pub struct AxisFlags: i32 {
pub struct AxisFlags: u32 {
/// "Default" according to original docs
const NONE = sys::ImPlotAxisFlags__ImPlotAxisFlags_None;
/// Grid lines will not be displayed

View file

@ -191,7 +191,7 @@ impl PlotText {
}
unsafe {
sys::ImPlot_PlotTextdouble(
sys::ImPlot_PlotText(
im_str!("{}", self.label).as_ptr() as *const i8,
x,
y,