only run bindgen on ImPlot... names
not sure why bindgen switches to i32 everywhere moved imgui dependency up one step as this seems where its actually used
This commit is contained in:
parent
cdc7e273c0
commit
6bdfd76d51
11 changed files with 31 additions and 8241 deletions
|
@ -12,6 +12,7 @@ readme = "README.md"
|
|||
|
||||
[dependencies]
|
||||
implot-sys = { version = "0.1.0", path = "implot-sys" }
|
||||
imgui = { version = "0.5.0" }
|
||||
bitflags = "1.0"
|
||||
parking_lot = "0.11"
|
||||
lazy_static = "1.1"
|
||||
|
|
|
@ -4,9 +4,6 @@ version = "0.1.0"
|
|||
authors = ["Sandro Merkli"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
bindgen = "0.53.1"
|
||||
bindgen = "0.55.1"
|
||||
imgui-sys = { version = "0.5.0" }
|
||||
imgui = { version = "0.5.0" }
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
use std::env;
|
||||
use std::io::Write;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
// We just forward the DEP_IMGUI_THIRD_PARTY variable here because the
|
||||
|
|
|
@ -34,6 +34,8 @@ fn main() {
|
|||
)
|
||||
.parse_callbacks(Box::new(CargoCallbacks))
|
||||
.clang_arg("-DCIMGUI_DEFINE_ENUMS_AND_STRUCTS=1")
|
||||
.whitelist_function("ImPlot.*")
|
||||
.whitelist_type("ImPlot.*")
|
||||
.generate()
|
||||
.expect("Unable to generate bindings");
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ links = "implot"
|
|||
|
||||
[dependencies]
|
||||
imgui-sys = "0.5.0"
|
||||
imgui = "0.5.0"
|
||||
|
||||
[build-dependencies]
|
||||
cc = "1.0"
|
||||
|
|
8217
implot-sys/src/bindings.rs
generated
8217
implot-sys/src/bindings.rs
generated
File diff suppressed because it is too large
Load diff
|
@ -2,6 +2,8 @@
|
|||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
pub use imgui;
|
||||
// just for linking for tests
|
||||
#[cfg(test)]
|
||||
use imgui_sys as _;
|
||||
|
||||
include!("bindings.rs");
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
use parking_lot::ReentrantMutex;
|
||||
|
||||
use crate::sys;
|
||||
use crate::PlotUi;
|
||||
|
||||
/// An implot context.
|
||||
///
|
||||
/// A context is required to do most of the things this library provides. While this was created
|
||||
|
@ -16,7 +16,7 @@ pub struct Context {
|
|||
raw: *mut sys::ImPlotContext,
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
lazy_static::lazy_static! {
|
||||
// This mutex is used to guard any accesses to the context
|
||||
static ref CTX_MUTEX: ReentrantMutex<()> = ReentrantMutex::new(());
|
||||
}
|
||||
|
|
18
src/lib.rs
18
src/lib.rs
|
@ -12,17 +12,11 @@
|
|||
//! you'd really like a particular feature, file an issue and it'll be given priority for wrapping,
|
||||
//! or directly contribute a PR, or use the low-level bindings directly for the time being.
|
||||
//!
|
||||
extern crate implot_sys as sys;
|
||||
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
use implot_sys as sys;
|
||||
|
||||
// TODO(4bb4) facade-wrap these?
|
||||
pub use sys::{imgui::Condition, ImPlotLimits, ImPlotPoint, ImPlotRange, ImVec2, ImVec4};
|
||||
|
||||
pub use self::context::*;
|
||||
pub use self::plot::*;
|
||||
pub use self::plot_elements::*;
|
||||
pub use self::{context::*, plot::*, plot_elements::*};
|
||||
pub use sys::{ImPlotLimits, ImPlotPoint, ImPlotRange, ImVec2, ImVec4};
|
||||
|
||||
mod context;
|
||||
mod plot;
|
||||
|
@ -89,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(u32)]
|
||||
#[repr(i32)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub enum PlotColorElement {
|
||||
/// Plot line/outline color (defaults to next unused color in current colormap)
|
||||
|
@ -143,7 +137,7 @@ pub enum PlotColorElement {
|
|||
}
|
||||
|
||||
/// Colormap choice. Documentation copied from implot.h for convenience.
|
||||
#[repr(u32)]
|
||||
#[repr(i32)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub enum Colormap {
|
||||
/// ImPlot default colormap (n=10). Called "Standard" here because Default is reserved.
|
||||
|
@ -170,7 +164,7 @@ pub enum Colormap {
|
|||
Jet = sys::ImPlotColormap__ImPlotColormap_Jet,
|
||||
}
|
||||
|
||||
#[repr(u32)]
|
||||
#[repr(i32)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub enum StyleVar {
|
||||
/// f32, line weight in pixels
|
||||
|
|
15
src/plot.rs
15
src/plot.rs
|
@ -2,13 +2,12 @@
|
|||
//!
|
||||
//! This module defines the `Plot` struct, which is used to create a 2D plot that will
|
||||
//! contain all other objects that can be created using this library.
|
||||
extern crate implot_sys as sys;
|
||||
use bitflags::bitflags;
|
||||
pub use sys::imgui::Condition;
|
||||
use sys::imgui::{im_str, ImString};
|
||||
pub use sys::{ImPlotLimits, ImPlotPoint, ImPlotRange, ImVec2, ImVec4};
|
||||
|
||||
use crate::{Context, PlotUi, YAxisChoice, NUMBER_OF_Y_AXES};
|
||||
use bitflags::bitflags;
|
||||
pub use imgui::Condition;
|
||||
use imgui::{im_str, ImString};
|
||||
use implot_sys as sys;
|
||||
pub use sys::{ImPlotLimits, ImPlotPoint, ImPlotRange, ImVec2, ImVec4};
|
||||
|
||||
const DEFAULT_PLOT_SIZE_X: f32 = 400.0;
|
||||
const DEFAULT_PLOT_SIZE_Y: f32 = 400.0;
|
||||
|
@ -18,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: u32 {
|
||||
pub struct PlotFlags: i32 {
|
||||
/// "Default" according to original docs
|
||||
const NONE = sys::ImPlotFlags__ImPlotFlags_None;
|
||||
/// Plot items will not be highlighted when their legend entry is hovered
|
||||
|
@ -52,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: u32 {
|
||||
pub struct AxisFlags: i32 {
|
||||
/// "Default" according to original docs
|
||||
const NONE = sys::ImPlotAxisFlags__ImPlotAxisFlags_None;
|
||||
/// Grid lines will not be displayed
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
//! This module defines the various structs that can be used for drawing different things such
|
||||
//! as lines, bars, scatter plots and text in a plot. For the module to create plots themselves,
|
||||
//! see `plot`.
|
||||
use sys::imgui::im_str;
|
||||
use crate::sys;
|
||||
use imgui::im_str;
|
||||
|
||||
// --- Actual plotting functionality -------------------------------------------------------------
|
||||
/// Struct to provide functionality for plotting a line in a plot.
|
||||
|
|
Loading…
Reference in a new issue