mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-11 05:28:35 +00:00
Use automatically generated 1.71 bindings from 0.1-dev
This is the minimal first step that compiles but doesn't work
This commit is contained in:
parent
3721aca8cf
commit
3ca1b7b4ec
@ -26,4 +26,5 @@ members = [
|
||||
exclude = [
|
||||
"imgui-examples",
|
||||
"imgui-glium-examples",
|
||||
"imgui-sys-bindgen"
|
||||
]
|
||||
|
||||
16
imgui-sys-bindgen/Cargo.toml
Normal file
16
imgui-sys-bindgen/Cargo.toml
Normal file
@ -0,0 +1,16 @@
|
||||
[package]
|
||||
name = "imgui-sys-bindgen"
|
||||
version = "0.0.0"
|
||||
authors = ["Joonas Javanainen <joonas.javanainen@gmail.com>", "imgui-rs contributors"]
|
||||
description = "imgui-sys bindings updater"
|
||||
homepage = "https://github.com/Gekkio/imgui-rs"
|
||||
repository = "https://github.com/Gekkio/imgui-rs"
|
||||
license = "MIT/Apache-2.0"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
bindgen = "0.49"
|
||||
failure = "0.1"
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
serde_json = "1.0"
|
||||
120
imgui-sys-bindgen/src/lib.rs
Normal file
120
imgui-sys-bindgen/src/lib.rs
Normal file
@ -0,0 +1,120 @@
|
||||
extern crate bindgen;
|
||||
#[macro_use]
|
||||
extern crate failure;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
extern crate serde_json;
|
||||
|
||||
use bindgen::{Bindings, EnumVariation, RustTarget};
|
||||
use failure::Error;
|
||||
use std::collections::HashMap;
|
||||
use std::fs::{read_to_string, File};
|
||||
use std::io::Read;
|
||||
use std::path::Path;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct StructsAndEnums {
|
||||
enums: HashMap<String, serde_json::Value>,
|
||||
structs: HashMap<String, serde_json::Value>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct DefinitionArg {
|
||||
#[serde(rename = "type")]
|
||||
type_: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Definition {
|
||||
#[serde(rename = "argsT")]
|
||||
args_t: Vec<DefinitionArg>,
|
||||
ov_cimguiname: String,
|
||||
#[serde(rename = "nonUDT")]
|
||||
non_udt: Option<u32>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct Whitelist {
|
||||
enums: Vec<String>,
|
||||
structs: Vec<String>,
|
||||
definitions: Vec<String>,
|
||||
}
|
||||
|
||||
fn only_key<K, V>((key, _): (K, V)) -> K {
|
||||
key
|
||||
}
|
||||
|
||||
fn parse_whitelist<R: Read>(
|
||||
structs_and_enums: R,
|
||||
definitions: R,
|
||||
) -> Result<Whitelist, serde_json::Error> {
|
||||
let StructsAndEnums { enums, structs } = serde_json::from_reader(structs_and_enums)?;
|
||||
let enums = enums.into_iter().map(only_key).collect();
|
||||
let structs = structs.into_iter().map(only_key).collect();
|
||||
|
||||
let definitions: HashMap<String, Vec<Definition>> = serde_json::from_reader(definitions)?;
|
||||
let definitions = definitions
|
||||
.into_iter()
|
||||
.flat_map(|(_, defs)| {
|
||||
let require_non_udt = defs.iter().any(|def| def.non_udt.is_some());
|
||||
defs.into_iter()
|
||||
.filter(move |def| !require_non_udt || def.non_udt.is_some())
|
||||
})
|
||||
.filter_map(|d| {
|
||||
let uses_va_list = d.args_t.iter().any(|a| a.type_ == "va_list");
|
||||
if uses_va_list {
|
||||
None
|
||||
} else {
|
||||
Some(d.ov_cimguiname)
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
||||
Ok(Whitelist {
|
||||
enums,
|
||||
structs,
|
||||
definitions,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn generate_bindings<P: AsRef<Path>>(cimgui_path: &P) -> Result<Bindings, Error> {
|
||||
let cimgui_output_path = cimgui_path.as_ref().join("generator").join("output");
|
||||
let structs_and_enums = File::open(cimgui_output_path.join("structs_and_enums.json"))?;
|
||||
let definitions = File::open(cimgui_output_path.join("definitions.json"))?;
|
||||
let header = read_to_string(cimgui_output_path.join("cimgui.h"))?;
|
||||
|
||||
let whitelist = parse_whitelist(structs_and_enums, definitions)?;
|
||||
let mut builder = bindgen::builder()
|
||||
.raw_line("#![allow(non_upper_case_globals)]")
|
||||
.raw_line("#![allow(non_camel_case_types)]")
|
||||
.raw_line("#![allow(non_snake_case)]")
|
||||
.raw_line("#![allow(clippy::all)]")
|
||||
.header_contents("cimgui.h", &header)
|
||||
.rust_target(RustTarget::Stable_1_28)
|
||||
.default_enum_style(EnumVariation::Consts)
|
||||
.prepend_enum_name(false)
|
||||
.generate_comments(false)
|
||||
.layout_tests(true)
|
||||
.derive_copy(true)
|
||||
.derive_debug(true)
|
||||
.derive_default(true)
|
||||
.derive_hash(true)
|
||||
.derive_partialeq(true)
|
||||
.derive_eq(true)
|
||||
.impl_debug(true)
|
||||
.rustfmt_bindings(true)
|
||||
.clang_arg("-DCIMGUI_DEFINE_ENUMS_AND_STRUCTS=1");
|
||||
for e in whitelist.structs {
|
||||
builder = builder.whitelist_type(format!("^{}", e));
|
||||
}
|
||||
for e in whitelist.enums {
|
||||
builder = builder.whitelist_type(format!("^{}", e));
|
||||
}
|
||||
for e in whitelist.definitions {
|
||||
builder = builder.whitelist_function(format!("^{}", e));
|
||||
}
|
||||
let bindings = builder
|
||||
.generate()
|
||||
.map_err(|_| format_err!("Failed to generate bindings"))?;
|
||||
Ok(bindings)
|
||||
}
|
||||
20
imgui-sys-bindgen/src/main.rs
Normal file
20
imgui-sys-bindgen/src/main.rs
Normal file
@ -0,0 +1,20 @@
|
||||
extern crate imgui_sys_bindgen;
|
||||
|
||||
use imgui_sys_bindgen::generate_bindings;
|
||||
use std::env;
|
||||
|
||||
fn main() {
|
||||
let cwd = env::current_dir().expect("Failed to read current directory");
|
||||
let sys_path = cwd
|
||||
.join("..")
|
||||
.join("imgui-sys")
|
||||
.canonicalize()
|
||||
.expect("Failed to find imgui-sys directory");
|
||||
let bindings = generate_bindings(&sys_path.join("third-party").join("cimgui"))
|
||||
.expect("Failed to generate bindings");
|
||||
let output_path = sys_path.join("src").join("bindings.rs");
|
||||
bindings
|
||||
.write_to_file(&output_path)
|
||||
.expect("Failed to write bindings");
|
||||
println!("Wrote bindings to {}", output_path.to_string_lossy());
|
||||
}
|
||||
@ -14,10 +14,10 @@ build = "build.rs"
|
||||
travis-ci = { repository = "Gekkio/imgui-rs" }
|
||||
|
||||
[dependencies]
|
||||
libc = "0.2"
|
||||
bitflags = "1.0"
|
||||
glium = { version = "0.25", default-features = false, optional = true }
|
||||
gfx = { version = "0.18", optional = true }
|
||||
libc = "0.2"
|
||||
|
||||
[build-dependencies]
|
||||
cc = "1.0"
|
||||
|
||||
9801
imgui-sys/src/bindings.rs
Normal file
9801
imgui-sys/src/bindings.rs
Normal file
File diff suppressed because it is too large
Load Diff
984
imgui-sys/src/legacy.rs
Normal file
984
imgui-sys/src/legacy.rs
Normal file
@ -0,0 +1,984 @@
|
||||
#![allow(non_upper_case_globals)]
|
||||
|
||||
use crate::*;
|
||||
use libc::size_t;
|
||||
use std::os::raw::{c_char, c_double, c_float, c_int, c_uint, c_void};
|
||||
|
||||
// Context creation and access
|
||||
extern "C" {
|
||||
pub fn igCreateContext(shared_font_atlas: *mut ImFontAtlas) -> *mut ImGuiContext;
|
||||
pub fn igDestroyContext(ctx: *mut ImGuiContext);
|
||||
pub fn igGetCurrentContext() -> *mut ImGuiContext;
|
||||
pub fn igSetCurrentContext(ctx: *mut ImGuiContext);
|
||||
pub fn igDebugCheckVersionAndDataLayout(
|
||||
version_str: *const c_char,
|
||||
sz_io: size_t,
|
||||
sz_style: size_t,
|
||||
sz_vec2: size_t,
|
||||
sz_vec4: size_t,
|
||||
sz_drawvert: size_t,
|
||||
) -> bool;
|
||||
}
|
||||
|
||||
// Main
|
||||
extern "C" {
|
||||
pub fn igGetIO() -> *mut ImGuiIO;
|
||||
pub fn igGetStyle() -> *mut ImGuiStyle;
|
||||
pub fn igNewFrame();
|
||||
pub fn igEndFrame();
|
||||
pub fn igRender();
|
||||
pub fn igGetDrawData() -> *mut ImDrawData;
|
||||
}
|
||||
|
||||
// Demo, Debug, Information
|
||||
extern "C" {
|
||||
pub fn igShowAboutWindow(opened: *mut bool);
|
||||
pub fn igShowDemoWindow(opened: *mut bool);
|
||||
pub fn igShowMetricsWindow(opened: *mut bool);
|
||||
pub fn igShowStyleEditor(style: *mut ImGuiStyle);
|
||||
pub fn igShowStyleSelector(label: *const c_char) -> bool;
|
||||
pub fn igShowFontSelector(label: *const c_char);
|
||||
pub fn igShowUserGuide();
|
||||
pub fn igGetVersion() -> *const c_char;
|
||||
}
|
||||
|
||||
// Styles
|
||||
extern "C" {
|
||||
pub fn igStyleColorsDark(dst: *mut ImGuiStyle);
|
||||
pub fn igStyleColorsClassic(dst: *mut ImGuiStyle);
|
||||
pub fn igStyleColorsLight(dst: *mut ImGuiStyle);
|
||||
}
|
||||
|
||||
// Windows
|
||||
extern "C" {
|
||||
pub fn igBegin(name: *const c_char, open: *mut bool, flags: ImGuiWindowFlags) -> bool;
|
||||
pub fn igEnd();
|
||||
pub fn igBeginChild(
|
||||
str_id: *const c_char,
|
||||
size: ImVec2,
|
||||
border: bool,
|
||||
flags: ImGuiWindowFlags,
|
||||
) -> bool;
|
||||
pub fn igBeginChildID(id: ImGuiID, size: ImVec2, border: bool, flags: ImGuiWindowFlags)
|
||||
-> bool;
|
||||
pub fn igEndChild();
|
||||
}
|
||||
|
||||
// Windows Utilities
|
||||
extern "C" {
|
||||
pub fn igIsWindowAppearing() -> bool;
|
||||
pub fn igIsWindowCollapsed() -> bool;
|
||||
pub fn igIsWindowFocused(flags: ImGuiFocusedFlags) -> bool;
|
||||
pub fn igIsWindowHovered(flags: ImGuiHoveredFlags) -> bool;
|
||||
pub fn igGetWindowDrawList() -> *mut ImDrawList;
|
||||
pub fn igGetWindowPos_nonUDT2() -> ImVec2;
|
||||
pub fn igGetWindowSize_nonUDT2() -> ImVec2;
|
||||
pub fn igGetWindowWidth() -> c_float;
|
||||
pub fn igGetWindowHeight() -> c_float;
|
||||
pub fn igGetContentRegionMax_nonUDT2() -> ImVec2;
|
||||
pub fn igGetContentRegionAvail_nonUDT2() -> ImVec2;
|
||||
pub fn igGetContentRegionAvailWidth() -> c_float;
|
||||
pub fn igGetWindowContentRegionMin_nonUDT2() -> ImVec2;
|
||||
pub fn igGetWindowContentRegionMax_nonUDT2() -> ImVec2;
|
||||
pub fn igGetWindowContentRegionWidth() -> c_float;
|
||||
|
||||
pub fn igSetNextWindowPos(pos: ImVec2, cond: ImGuiCond, pivot: ImVec2);
|
||||
pub fn igSetNextWindowSize(size: ImVec2, cond: ImGuiCond);
|
||||
pub fn igSetNextWindowSizeConstraints(
|
||||
size_min: ImVec2,
|
||||
size_max: ImVec2,
|
||||
custom_callback: ImGuiSizeCallback,
|
||||
custom_callback_data: *mut c_void,
|
||||
);
|
||||
pub fn igSetNextWindowContentSize(size: ImVec2);
|
||||
pub fn igSetNextWindowCollapsed(collapsed: bool, cond: ImGuiCond);
|
||||
pub fn igSetNextWindowFocus();
|
||||
pub fn igSetNextWindowBgAlpha(alpha: c_float);
|
||||
pub fn igSetWindowPosVec2(pos: ImVec2, cond: ImGuiCond);
|
||||
pub fn igSetWindowSizeVec2(size: ImVec2, cond: ImGuiCond);
|
||||
pub fn igSetWindowCollapsedBool(collapsed: bool, cond: ImGuiCond);
|
||||
pub fn igSetWindowFocus();
|
||||
pub fn igSetWindowFontScale(scale: c_float);
|
||||
pub fn igSetWindowPosStr(name: *const c_char, pos: ImVec2, cond: ImGuiCond);
|
||||
pub fn igSetWindowSizeStr(name: *const c_char, size: ImVec2, cond: ImGuiCond);
|
||||
pub fn igSetWindowCollapsedStr(name: *const c_char, collapsed: bool, cond: ImGuiCond);
|
||||
pub fn igSetWindowFocusStr(name: *const c_char);
|
||||
}
|
||||
|
||||
// Windows scrolling
|
||||
extern "C" {
|
||||
pub fn igGetScrollX() -> c_float;
|
||||
pub fn igGetScrollY() -> c_float;
|
||||
pub fn igGetScrollMaxX() -> c_float;
|
||||
pub fn igGetScrollMaxY() -> c_float;
|
||||
pub fn igSetScrollX(scroll_x: c_float);
|
||||
pub fn igSetScrollY(scroll_y: c_float);
|
||||
pub fn igSetScrollHereY(center_y_ratio: c_float);
|
||||
pub fn igSetScrollFromPosY(pos_y: c_float, center_y_ratio: c_float);
|
||||
}
|
||||
|
||||
// Parameter stacks (shared)
|
||||
extern "C" {
|
||||
pub fn igPushFont(font: *mut ImFont);
|
||||
pub fn igPopFont();
|
||||
pub fn igPushStyleColorU32(idx: ImGuiCol, col: ImU32);
|
||||
pub fn igPushStyleColor(idx: ImGuiCol, col: ImVec4);
|
||||
pub fn igPopStyleColor(count: c_int);
|
||||
pub fn igPushStyleVarFloat(idx: ImGuiStyleVar, val: c_float);
|
||||
pub fn igPushStyleVarVec2(idx: ImGuiStyleVar, val: ImVec2);
|
||||
pub fn igPopStyleVar(count: c_int);
|
||||
pub fn igGetStyleColorVec4(idx: ImGuiCol) -> *const ImVec4;
|
||||
pub fn igGetFont() -> *mut ImFont;
|
||||
pub fn igGetFontSize() -> c_float;
|
||||
pub fn igGetFontTexUvWhitePixel_nonUDT2() -> ImVec2;
|
||||
pub fn igGetColorU32(idx: ImGuiCol, alpha_mul: c_float) -> ImU32;
|
||||
pub fn igGetColorU32Vec(col: ImVec4) -> ImU32;
|
||||
pub fn igGetColorU32U32(col: ImU32) -> ImU32;
|
||||
}
|
||||
|
||||
// Parameter stack (current window)
|
||||
extern "C" {
|
||||
pub fn igPushItemWidth(item_width: c_float);
|
||||
pub fn igPopItemWidth();
|
||||
pub fn igCalcItemWidth() -> c_float;
|
||||
pub fn igPushTextWrapPos(wrap_pos_x: c_float);
|
||||
pub fn igPopTextWrapPos();
|
||||
pub fn igPushAllowKeyboardFocus(allow_keyboard_focus: bool);
|
||||
pub fn igPopAllowKeyboardFocus();
|
||||
pub fn igPushButtonRepeat(repeat: bool);
|
||||
pub fn igPopButtonRepeat();
|
||||
}
|
||||
|
||||
// Cursor / Layout
|
||||
extern "C" {
|
||||
pub fn igSeparator();
|
||||
pub fn igSameLine(pos_x: c_float, spacing_w: c_float);
|
||||
pub fn igNewLine();
|
||||
pub fn igSpacing();
|
||||
pub fn igDummy(size: ImVec2);
|
||||
pub fn igIndent(indent_w: c_float);
|
||||
pub fn igUnindent(indent_w: c_float);
|
||||
pub fn igBeginGroup();
|
||||
pub fn igEndGroup();
|
||||
pub fn igGetCursorPos_nonUDT2() -> ImVec2;
|
||||
pub fn igGetCursorPosX() -> c_float;
|
||||
pub fn igGetCursorPosY() -> c_float;
|
||||
pub fn igSetCursorPos(local_pos: ImVec2);
|
||||
pub fn igSetCursorPosX(x: c_float);
|
||||
pub fn igSetCursorPosY(y: c_float);
|
||||
pub fn igGetCursorStartPos_nonUDT2() -> ImVec2;
|
||||
pub fn igGetCursorScreenPos_nonUDT2() -> ImVec2;
|
||||
pub fn igSetCursorScreenPos(screen_pos: ImVec2);
|
||||
pub fn igAlignTextToFramePadding();
|
||||
pub fn igGetTextLineHeight() -> c_float;
|
||||
pub fn igGetTextLineHeightWithSpacing() -> c_float;
|
||||
pub fn igGetFrameHeight() -> c_float;
|
||||
pub fn igGetFrameHeightWithSpacing() -> c_float;
|
||||
}
|
||||
|
||||
// ID stack/scopes
|
||||
extern "C" {
|
||||
pub fn igPushIDStr(str_id: *const c_char);
|
||||
pub fn igPushIDRange(str_id_begin: *const c_char, str_id_end: *const c_char);
|
||||
pub fn igPushIDPtr(ptr_id: *const c_void);
|
||||
pub fn igPushIDInt(int_id: c_int);
|
||||
pub fn igPopID();
|
||||
pub fn igGetIDStr(str_id: *const c_char) -> ImGuiID;
|
||||
pub fn igGetIDStrStr(str_id_begin: *const c_char, str_id_end: *const c_char) -> ImGuiID;
|
||||
pub fn igGetIDPtr(ptr_id: *const c_void) -> ImGuiID;
|
||||
}
|
||||
|
||||
// Widgets: Text
|
||||
extern "C" {
|
||||
pub fn igTextUnformatted(text: *const c_char, text_end: *const c_char);
|
||||
pub fn igText(fmt: *const c_char, ...);
|
||||
pub fn igTextColored(col: ImVec4, fmt: *const c_char, ...);
|
||||
pub fn igTextDisabled(fmt: *const c_char, ...);
|
||||
pub fn igTextWrapped(fmt: *const c_char, ...);
|
||||
pub fn igLabelText(label: *const c_char, fmt: *const c_char, ...);
|
||||
pub fn igBulletText(fmt: *const c_char, ...);
|
||||
}
|
||||
|
||||
// Widgets: Main
|
||||
extern "C" {
|
||||
pub fn igButton(label: *const c_char, size: ImVec2) -> bool;
|
||||
pub fn igSmallButton(label: *const c_char) -> bool;
|
||||
pub fn igInvisibleButton(str_id: *const c_char, size: ImVec2) -> bool;
|
||||
pub fn igArrowButton(str_id: *const c_char, dir: ImGuiDir) -> bool;
|
||||
pub fn igImage(
|
||||
user_texture_id: ImTextureID,
|
||||
size: ImVec2,
|
||||
uv0: ImVec2,
|
||||
uv1: ImVec2,
|
||||
tint_col: ImVec4,
|
||||
border_col: ImVec4,
|
||||
);
|
||||
pub fn igImageButton(
|
||||
user_texture_id: ImTextureID,
|
||||
size: ImVec2,
|
||||
uv0: ImVec2,
|
||||
uv1: ImVec2,
|
||||
frame_padding: c_int,
|
||||
bg_col: ImVec4,
|
||||
tint_col: ImVec4,
|
||||
) -> bool;
|
||||
pub fn igCheckbox(label: *const c_char, v: *mut bool) -> bool;
|
||||
pub fn igCheckboxFlags(label: *const c_char, flags: *mut c_uint, flags_value: c_uint) -> bool;
|
||||
pub fn igRadioButtonBool(label: *const c_char, active: bool) -> bool;
|
||||
pub fn igRadioButtonIntPtr(label: *const c_char, v: *mut c_int, v_button: c_int) -> bool;
|
||||
pub fn igProgressBar(fraction: c_float, size_arg: ImVec2, overlay: *const c_char);
|
||||
pub fn igBullet();
|
||||
}
|
||||
|
||||
// Widgets: Combo Box
|
||||
extern "C" {
|
||||
pub fn igBeginCombo(
|
||||
label: *const c_char,
|
||||
preview_value: *const c_char,
|
||||
flags: ImGuiComboFlags,
|
||||
) -> bool;
|
||||
pub fn igEndCombo();
|
||||
pub fn igCombo(
|
||||
label: *const c_char,
|
||||
current_item: *mut c_int,
|
||||
items: *const *const c_char,
|
||||
items_count: c_int,
|
||||
popup_max_height_in_items: c_int,
|
||||
) -> bool;
|
||||
pub fn igComboStr(
|
||||
label: *const c_char,
|
||||
current_item: *mut c_int,
|
||||
items_separated_by_zeros: *const c_char,
|
||||
popup_max_height_in_items: c_int,
|
||||
) -> bool;
|
||||
pub fn igComboFnPtr(
|
||||
label: *const c_char,
|
||||
current_item: *mut c_int,
|
||||
items_getter: extern "C" fn(
|
||||
data: *mut c_void,
|
||||
idx: c_int,
|
||||
out_text: *mut *const c_char,
|
||||
) -> bool,
|
||||
data: *mut c_void,
|
||||
items_count: c_int,
|
||||
popup_max_height_in_items: c_int,
|
||||
) -> bool;
|
||||
}
|
||||
|
||||
// Widgets: Drags
|
||||
extern "C" {
|
||||
pub fn igDragFloat(
|
||||
label: *const c_char,
|
||||
v: *mut c_float,
|
||||
v_speed: c_float,
|
||||
v_min: c_float,
|
||||
v_max: c_float,
|
||||
format: *const c_char,
|
||||
power: c_float,
|
||||
) -> bool;
|
||||
pub fn igDragFloat2(
|
||||
label: *const c_char,
|
||||
v: *mut c_float,
|
||||
v_speed: c_float,
|
||||
v_min: c_float,
|
||||
v_max: c_float,
|
||||
format: *const c_char,
|
||||
power: c_float,
|
||||
) -> bool;
|
||||
pub fn igDragFloat3(
|
||||
label: *const c_char,
|
||||
v: *mut c_float,
|
||||
v_speed: c_float,
|
||||
v_min: c_float,
|
||||
v_max: c_float,
|
||||
format: *const c_char,
|
||||
power: c_float,
|
||||
) -> bool;
|
||||
pub fn igDragFloat4(
|
||||
label: *const c_char,
|
||||
v: *mut c_float,
|
||||
v_speed: c_float,
|
||||
v_min: c_float,
|
||||
v_max: c_float,
|
||||
format: *const c_char,
|
||||
power: c_float,
|
||||
) -> bool;
|
||||
pub fn igDragFloatRange2(
|
||||
label: *const c_char,
|
||||
v_current_min: *mut c_float,
|
||||
v_current_max: *mut c_float,
|
||||
v_speed: c_float,
|
||||
v_min: c_float,
|
||||
v_max: c_float,
|
||||
format: *const c_char,
|
||||
format_max: *const c_char,
|
||||
power: c_float,
|
||||
) -> bool;
|
||||
pub fn igDragInt(
|
||||
label: *const c_char,
|
||||
v: *mut c_int,
|
||||
v_speed: c_float,
|
||||
v_min: c_int,
|
||||
v_max: c_int,
|
||||
format: *const c_char,
|
||||
) -> bool;
|
||||
pub fn igDragInt2(
|
||||
label: *const c_char,
|
||||
v: *mut c_int,
|
||||
v_speed: c_float,
|
||||
v_min: c_int,
|
||||
v_max: c_int,
|
||||
format: *const c_char,
|
||||
) -> bool;
|
||||
pub fn igDragInt3(
|
||||
label: *const c_char,
|
||||
v: *mut c_int,
|
||||
v_speed: c_float,
|
||||
v_min: c_int,
|
||||
v_max: c_int,
|
||||
format: *const c_char,
|
||||
) -> bool;
|
||||
pub fn igDragInt4(
|
||||
label: *const c_char,
|
||||
v: *mut c_int,
|
||||
v_speed: c_float,
|
||||
v_min: c_int,
|
||||
v_max: c_int,
|
||||
format: *const c_char,
|
||||
) -> bool;
|
||||
pub fn igDragIntRange2(
|
||||
label: *const c_char,
|
||||
v_current_min: *mut c_int,
|
||||
v_current_max: *mut c_int,
|
||||
v_speed: c_float,
|
||||
v_min: c_int,
|
||||
v_max: c_int,
|
||||
format: *const c_char,
|
||||
format_max: *const c_char,
|
||||
) -> bool;
|
||||
pub fn igDragScalar(
|
||||
label: *const c_char,
|
||||
data_type: ImGuiDataType,
|
||||
v: *mut c_void,
|
||||
v_speed: c_float,
|
||||
v_min: *const c_void,
|
||||
v_max: *const c_void,
|
||||
format: *const c_char,
|
||||
power: c_float,
|
||||
) -> bool;
|
||||
pub fn igDragScalarN(
|
||||
label: *const c_char,
|
||||
data_type: ImGuiDataType,
|
||||
v: *mut c_void,
|
||||
components: c_int,
|
||||
v_speed: c_float,
|
||||
v_min: *const c_void,
|
||||
v_max: *const c_void,
|
||||
format: *const c_char,
|
||||
power: c_float,
|
||||
) -> bool;
|
||||
}
|
||||
|
||||
// Widgets: Sliders
|
||||
extern "C" {
|
||||
pub fn igSliderFloat(
|
||||
label: *const c_char,
|
||||
v: *mut c_float,
|
||||
v_min: c_float,
|
||||
v_max: c_float,
|
||||
format: *const c_char,
|
||||
power: c_float,
|
||||
) -> bool;
|
||||
pub fn igSliderFloat2(
|
||||
label: *const c_char,
|
||||
v: *mut c_float,
|
||||
v_min: c_float,
|
||||
v_max: c_float,
|
||||
format: *const c_char,
|
||||
power: c_float,
|
||||
) -> bool;
|
||||
pub fn igSliderFloat3(
|
||||
label: *const c_char,
|
||||
v: *mut c_float,
|
||||
v_min: c_float,
|
||||
v_max: c_float,
|
||||
format: *const c_char,
|
||||
power: c_float,
|
||||
) -> bool;
|
||||
pub fn igSliderFloat4(
|
||||
label: *const c_char,
|
||||
v: *mut c_float,
|
||||
v_min: c_float,
|
||||
v_max: c_float,
|
||||
format: *const c_char,
|
||||
power: c_float,
|
||||
) -> bool;
|
||||
pub fn igSliderAngle(
|
||||
label: *const c_char,
|
||||
v_rad: *mut c_float,
|
||||
v_degrees_min: c_float,
|
||||
v_degrees_max: c_float,
|
||||
format: *const c_char,
|
||||
) -> bool;
|
||||
pub fn igSliderInt(
|
||||
label: *const c_char,
|
||||
v: *mut c_int,
|
||||
v_min: c_int,
|
||||
v_max: c_int,
|
||||
format: *const c_char,
|
||||
) -> bool;
|
||||
pub fn igSliderInt2(
|
||||
label: *const c_char,
|
||||
v: *mut c_int,
|
||||
v_min: c_int,
|
||||
v_max: c_int,
|
||||
format: *const c_char,
|
||||
) -> bool;
|
||||
pub fn igSliderInt3(
|
||||
label: *const c_char,
|
||||
v: *mut c_int,
|
||||
v_min: c_int,
|
||||
v_max: c_int,
|
||||
format: *const c_char,
|
||||
) -> bool;
|
||||
pub fn igSliderInt4(
|
||||
label: *const c_char,
|
||||
v: *mut c_int,
|
||||
v_min: c_int,
|
||||
v_max: c_int,
|
||||
format: *const c_char,
|
||||
) -> bool;
|
||||
pub fn igSliderScalar(
|
||||
label: *const c_char,
|
||||
data_type: ImGuiDataType,
|
||||
v: *mut c_void,
|
||||
v_min: *const c_void,
|
||||
v_max: *const c_void,
|
||||
format: *const c_char,
|
||||
power: c_float,
|
||||
) -> bool;
|
||||
pub fn igSliderScalarN(
|
||||
label: *const c_char,
|
||||
data_type: ImGuiDataType,
|
||||
v: *mut c_void,
|
||||
components: c_int,
|
||||
v_min: *const c_void,
|
||||
v_max: *const c_void,
|
||||
format: *const c_char,
|
||||
power: c_float,
|
||||
) -> bool;
|
||||
pub fn igVSliderFloat(
|
||||
label: *const c_char,
|
||||
size: ImVec2,
|
||||
v: *mut c_float,
|
||||
v_min: c_float,
|
||||
v_max: c_float,
|
||||
format: *const c_char,
|
||||
power: c_float,
|
||||
) -> bool;
|
||||
pub fn igVSliderInt(
|
||||
label: *const c_char,
|
||||
size: ImVec2,
|
||||
v: *mut c_int,
|
||||
v_min: c_int,
|
||||
v_max: c_int,
|
||||
format: *const c_char,
|
||||
) -> bool;
|
||||
pub fn igVSliderScalar(
|
||||
label: *const c_char,
|
||||
size: ImVec2,
|
||||
data_type: ImGuiDataType,
|
||||
v: *mut c_void,
|
||||
v_min: *const c_void,
|
||||
v_max: *const c_void,
|
||||
format: *const c_char,
|
||||
power: c_float,
|
||||
) -> bool;
|
||||
}
|
||||
|
||||
// Widgets: Input with Keyboard
|
||||
extern "C" {
|
||||
pub fn igInputText(
|
||||
label: *const c_char,
|
||||
buf: *mut c_char,
|
||||
buf_size: usize,
|
||||
flags: ImGuiInputTextFlags,
|
||||
callback: ImGuiInputTextCallback,
|
||||
user_data: *mut c_void,
|
||||
) -> bool;
|
||||
pub fn igInputTextMultiline(
|
||||
label: *const c_char,
|
||||
buf: *mut c_char,
|
||||
buf_size: usize,
|
||||
size: ImVec2,
|
||||
flags: ImGuiInputTextFlags,
|
||||
callback: ImGuiInputTextCallback,
|
||||
user_data: *mut c_void,
|
||||
) -> bool;
|
||||
pub fn igInputFloat(
|
||||
label: *const c_char,
|
||||
v: *mut c_float,
|
||||
step: c_float,
|
||||
step_fast: c_float,
|
||||
format: *const c_char,
|
||||
extra_flags: ImGuiInputTextFlags,
|
||||
) -> bool;
|
||||
pub fn igInputFloat2(
|
||||
label: *const c_char,
|
||||
v: *mut c_float,
|
||||
format: *const c_char,
|
||||
extra_flags: ImGuiInputTextFlags,
|
||||
) -> bool;
|
||||
pub fn igInputFloat3(
|
||||
label: *const c_char,
|
||||
v: *mut c_float,
|
||||
format: *const c_char,
|
||||
extra_flags: ImGuiInputTextFlags,
|
||||
) -> bool;
|
||||
pub fn igInputFloat4(
|
||||
label: *const c_char,
|
||||
v: *mut c_float,
|
||||
format: *const c_char,
|
||||
extra_flags: ImGuiInputTextFlags,
|
||||
) -> bool;
|
||||
pub fn igInputInt(
|
||||
label: *const c_char,
|
||||
v: *mut c_int,
|
||||
step: c_int,
|
||||
step_fast: c_int,
|
||||
extra_flags: ImGuiInputTextFlags,
|
||||
) -> bool;
|
||||
pub fn igInputInt2(
|
||||
label: *const c_char,
|
||||
v: *mut c_int,
|
||||
extra_flags: ImGuiInputTextFlags,
|
||||
) -> bool;
|
||||
pub fn igInputInt3(
|
||||
label: *const c_char,
|
||||
v: *mut c_int,
|
||||
extra_flags: ImGuiInputTextFlags,
|
||||
) -> bool;
|
||||
pub fn igInputInt4(
|
||||
label: *const c_char,
|
||||
v: *mut c_int,
|
||||
extra_flags: ImGuiInputTextFlags,
|
||||
) -> bool;
|
||||
pub fn igInputDouble(
|
||||
label: *const c_char,
|
||||
v: *mut c_double,
|
||||
step: c_double,
|
||||
step_fast: c_double,
|
||||
format: *const c_char,
|
||||
extra_flags: ImGuiInputTextFlags,
|
||||
) -> bool;
|
||||
pub fn igInputScalar(
|
||||
label: *const c_char,
|
||||
data_type: ImGuiDataType,
|
||||
v: *mut c_void,
|
||||
step: *const c_void,
|
||||
step_fast: *const c_void,
|
||||
format: *const c_char,
|
||||
extra_flags: ImGuiInputTextFlags,
|
||||
) -> bool;
|
||||
pub fn igInputScalarN(
|
||||
label: *const c_char,
|
||||
data_type: ImGuiDataType,
|
||||
v: *mut c_void,
|
||||
components: c_int,
|
||||
step: *const c_void,
|
||||
step_fast: *const c_void,
|
||||
format: *const c_char,
|
||||
extra_flags: ImGuiInputTextFlags,
|
||||
) -> bool;
|
||||
}
|
||||
|
||||
// Widgets: Color Editor/Picker
|
||||
extern "C" {
|
||||
pub fn igColorEdit3(
|
||||
label: *const c_char,
|
||||
col: *mut c_float,
|
||||
flags: ImGuiColorEditFlags,
|
||||
) -> bool;
|
||||
pub fn igColorEdit4(
|
||||
label: *const c_char,
|
||||
col: *mut c_float,
|
||||
flags: ImGuiColorEditFlags,
|
||||
) -> bool;
|
||||
pub fn igColorPicker3(
|
||||
label: *const c_char,
|
||||
col: *mut c_float,
|
||||
flags: ImGuiColorEditFlags,
|
||||
) -> bool;
|
||||
pub fn igColorPicker4(
|
||||
label: *const c_char,
|
||||
col: *mut c_float,
|
||||
flags: ImGuiColorEditFlags,
|
||||
ref_col: *const c_float,
|
||||
) -> bool;
|
||||
pub fn igColorButton(
|
||||
desc_id: *const c_char,
|
||||
col: ImVec4,
|
||||
flags: ImGuiColorEditFlags,
|
||||
size: ImVec2,
|
||||
) -> bool;
|
||||
pub fn igSetColorEditOptions(flags: ImGuiColorEditFlags);
|
||||
}
|
||||
|
||||
// Widgets: Trees
|
||||
extern "C" {
|
||||
pub fn igTreeNodeStr(label: *const c_char) -> bool;
|
||||
pub fn igTreeNodeStrStr(str_id: *const c_char, fmt: *const c_char, ...) -> bool;
|
||||
pub fn igTreeNodePtr(ptr_id: *const c_void, fmt: *const c_char, ...) -> bool;
|
||||
pub fn igTreeNodeExStr(label: *const c_char, flags: ImGuiTreeNodeFlags) -> bool;
|
||||
pub fn igTreeNodeExStrStr(
|
||||
str_id: *const c_char,
|
||||
flags: ImGuiTreeNodeFlags,
|
||||
fmt: *const c_char,
|
||||
...
|
||||
) -> bool;
|
||||
pub fn igTreeNodeExPtr(
|
||||
ptr_id: *const c_void,
|
||||
flags: ImGuiTreeNodeFlags,
|
||||
fmt: *const c_char,
|
||||
...
|
||||
) -> bool;
|
||||
pub fn igTreePushStr(str_id: *const c_char);
|
||||
pub fn igTreePushPtr(ptr_id: *const c_void);
|
||||
pub fn igTreePop();
|
||||
pub fn igTreeAdvanceToLabelPos();
|
||||
pub fn igGetTreeNodeToLabelSpacing() -> c_float;
|
||||
pub fn igSetNextTreeNodeOpen(opened: bool, cond: ImGuiCond);
|
||||
pub fn igCollapsingHeader(label: *const c_char, flags: ImGuiTreeNodeFlags) -> bool;
|
||||
pub fn igCollapsingHeaderBoolPtr(
|
||||
label: *const c_char,
|
||||
open: *mut bool,
|
||||
flags: ImGuiTreeNodeFlags,
|
||||
) -> bool;
|
||||
}
|
||||
|
||||
// Widgets: Selectables
|
||||
extern "C" {
|
||||
pub fn igSelectable(
|
||||
label: *const c_char,
|
||||
selected: bool,
|
||||
flags: ImGuiSelectableFlags,
|
||||
size: ImVec2,
|
||||
) -> bool;
|
||||
pub fn igSelectableBoolPtr(
|
||||
label: *const c_char,
|
||||
p_selected: *mut bool,
|
||||
flags: ImGuiSelectableFlags,
|
||||
size: ImVec2,
|
||||
) -> bool;
|
||||
}
|
||||
|
||||
// Widgets: List Boxes
|
||||
extern "C" {
|
||||
pub fn igListBoxStr_arr(
|
||||
label: *const c_char,
|
||||
current_item: *mut c_int,
|
||||
items: *const *const c_char,
|
||||
items_count: c_int,
|
||||
height_in_items: c_int,
|
||||
) -> bool;
|
||||
pub fn igListBoxFnPtr(
|
||||
label: *const c_char,
|
||||
current_item: *mut c_int,
|
||||
items_getter: extern "C" fn(
|
||||
data: *mut c_void,
|
||||
idx: c_int,
|
||||
out_text: *mut *const c_char,
|
||||
) -> bool,
|
||||
data: *mut c_void,
|
||||
items_count: c_int,
|
||||
height_in_items: c_int,
|
||||
) -> bool;
|
||||
pub fn igListBoxHeaderVec2(label: *const c_char, size: ImVec2) -> bool;
|
||||
pub fn igListBoxHeaderInt(
|
||||
label: *const c_char,
|
||||
items_count: c_int,
|
||||
height_in_items: c_int,
|
||||
) -> bool;
|
||||
pub fn igListBoxFooter();
|
||||
}
|
||||
|
||||
// Widgets: Data Plotting
|
||||
extern "C" {
|
||||
pub fn igPlotLines(
|
||||
label: *const c_char,
|
||||
values: *const c_float,
|
||||
values_count: c_int,
|
||||
values_offset: c_int,
|
||||
overlay_text: *const c_char,
|
||||
scale_min: c_float,
|
||||
scale_max: c_float,
|
||||
graph_size: ImVec2,
|
||||
stride: c_int,
|
||||
);
|
||||
pub fn igPlotLinesFnPtr(
|
||||
label: *const c_char,
|
||||
values_getter: extern "C" fn(data: *mut c_void, idx: c_int) -> c_float,
|
||||
data: *mut c_void,
|
||||
values_count: c_int,
|
||||
values_offset: c_int,
|
||||
overlay_text: *const c_char,
|
||||
scale_min: c_float,
|
||||
scale_max: c_float,
|
||||
graph_size: ImVec2,
|
||||
);
|
||||
pub fn igPlotHistogramFloatPtr(
|
||||
label: *const c_char,
|
||||
values: *const c_float,
|
||||
values_count: c_int,
|
||||
values_offset: c_int,
|
||||
overlay_text: *const c_char,
|
||||
scale_min: c_float,
|
||||
scale_max: c_float,
|
||||
graph_size: ImVec2,
|
||||
stride: c_int,
|
||||
);
|
||||
pub fn igPlotHistogramFnPtr(
|
||||
label: *const c_char,
|
||||
values_getter: extern "C" fn(data: *mut c_void, idx: c_int) -> c_float,
|
||||
data: *mut c_void,
|
||||
values_count: c_int,
|
||||
values_offset: c_int,
|
||||
overlay_text: *const c_char,
|
||||
scale_min: c_float,
|
||||
scale_max: c_float,
|
||||
graph_size: ImVec2,
|
||||
);
|
||||
}
|
||||
|
||||
// Widgets: Value() Helpers
|
||||
extern "C" {
|
||||
pub fn igValueBool(prefix: *const c_char, b: bool);
|
||||
pub fn igValueInt(prefix: *const c_char, v: c_int);
|
||||
pub fn igValueUInt(prefix: *const c_char, v: c_uint);
|
||||
pub fn igValueFloat(prefix: *const c_char, v: c_float, float_format: *const c_char);
|
||||
}
|
||||
|
||||
// Widgets: Menus
|
||||
extern "C" {
|
||||
pub fn igBeginMainMenuBar() -> bool;
|
||||
pub fn igEndMainMenuBar();
|
||||
pub fn igBeginMenuBar() -> bool;
|
||||
pub fn igEndMenuBar();
|
||||
pub fn igBeginMenu(label: *const c_char, enabled: bool) -> bool;
|
||||
pub fn igEndMenu();
|
||||
pub fn igMenuItemBool(
|
||||
label: *const c_char,
|
||||
shortcut: *const c_char,
|
||||
selected: bool,
|
||||
enabled: bool,
|
||||
) -> bool;
|
||||
pub fn igMenuItemBoolPtr(
|
||||
label: *const c_char,
|
||||
shortcut: *const c_char,
|
||||
p_selected: *mut bool,
|
||||
enabled: bool,
|
||||
) -> bool;
|
||||
}
|
||||
|
||||
// Tooltips
|
||||
extern "C" {
|
||||
pub fn igBeginTooltip();
|
||||
pub fn igEndTooltip();
|
||||
pub fn igSetTooltip(fmt: *const c_char, ...);
|
||||
}
|
||||
|
||||
// Popups
|
||||
extern "C" {
|
||||
pub fn igOpenPopup(str_id: *const c_char);
|
||||
pub fn igBeginPopup(str_id: *const c_char, flags: ImGuiWindowFlags) -> bool;
|
||||
pub fn igBeginPopupContextItem(str_id: *const c_char, mouse_button: c_int) -> bool;
|
||||
pub fn igBeginPopupContextWindow(
|
||||
str_id: *const c_char,
|
||||
mouse_button: c_int,
|
||||
also_over_items: bool,
|
||||
) -> bool;
|
||||
pub fn igBeginPopupContextVoid(str_id: *const c_char, mouse_button: c_int) -> bool;
|
||||
pub fn igBeginPopupModal(name: *const c_char, open: *mut bool, flags: ImGuiWindowFlags)
|
||||
-> bool;
|
||||
pub fn igEndPopup();
|
||||
pub fn igOpenPopupOnItemClick(str_id: *const c_char, mouse_button: c_int) -> bool;
|
||||
pub fn igIsPopupOpen(str_id: *const c_char) -> bool;
|
||||
pub fn igCloseCurrentPopup();
|
||||
}
|
||||
|
||||
// Columns
|
||||
extern "C" {
|
||||
pub fn igColumns(count: c_int, id: *const c_char, border: bool);
|
||||
pub fn igNextColumn();
|
||||
pub fn igGetColumnIndex() -> c_int;
|
||||
pub fn igGetColumnWidth(column_index: c_int) -> c_float;
|
||||
pub fn igSetColumnWidth(column_index: c_int, width: c_float);
|
||||
pub fn igGetColumnOffset(column_index: c_int) -> c_float;
|
||||
pub fn igSetColumnOffset(column_index: c_int, offset_x: c_float);
|
||||
pub fn igGetColumnsCount() -> c_int;
|
||||
}
|
||||
|
||||
// Logging/Capture
|
||||
extern "C" {
|
||||
pub fn igLogToTTY(max_depth: c_int);
|
||||
pub fn igLogToFile(max_depth: c_int, filename: *const c_char);
|
||||
pub fn igLogToClipboard(max_depth: c_int);
|
||||
pub fn igLogFinish();
|
||||
pub fn igLogButtons();
|
||||
pub fn igLogText(fmt: *const c_char, ...);
|
||||
}
|
||||
|
||||
// Drag and Drop
|
||||
extern "C" {
|
||||
/// Call when current ID is active.
|
||||
///
|
||||
/// When this returns true you need to:
|
||||
///
|
||||
/// 1. call [`igSetDragDropPayload`] exactly once,
|
||||
/// 2. you may render the payload visual/description,
|
||||
/// 3. pcall [`igEndDragDropSource`]
|
||||
pub fn igBeginDragDropSource(flags: ImGuiDragDropFlags) -> bool;
|
||||
/// Use 'cond' to choose to submit payload on drag start or every frame
|
||||
pub fn igSetDragDropPayload(
|
||||
type_: *const c_char,
|
||||
data: *const c_void,
|
||||
size: size_t,
|
||||
cond: ImGuiCond,
|
||||
) -> bool;
|
||||
pub fn igEndDragDropSource();
|
||||
pub fn igBeginDragDropTarget() -> bool;
|
||||
pub fn igAcceptDragDropPayload(
|
||||
type_: *const c_char,
|
||||
flags: ImGuiDragDropFlags,
|
||||
) -> *const ImGuiPayload;
|
||||
pub fn igEndDragDropTarget();
|
||||
pub fn igGetDragDropPayload() -> *const ImGuiPayload;
|
||||
}
|
||||
|
||||
// Clipping
|
||||
extern "C" {
|
||||
pub fn igPushClipRect(
|
||||
clip_rect_min: ImVec2,
|
||||
clip_rect_max: ImVec2,
|
||||
intersect_with_current_clip_rect: bool,
|
||||
);
|
||||
pub fn igPopClipRect();
|
||||
}
|
||||
|
||||
// Focus
|
||||
extern "C" {
|
||||
pub fn igSetItemDefaultFocus();
|
||||
pub fn igSetKeyboardFocusHere(offset: c_int);
|
||||
}
|
||||
|
||||
// Utilities
|
||||
extern "C" {
|
||||
pub fn igIsItemHovered(flags: ImGuiHoveredFlags) -> bool;
|
||||
pub fn igIsItemActive() -> bool;
|
||||
pub fn igIsItemFocused() -> bool;
|
||||
pub fn igIsItemClicked(mouse_button: c_int) -> bool;
|
||||
pub fn igIsItemVisible() -> bool;
|
||||
pub fn igIsItemEdited() -> bool;
|
||||
pub fn igIsItemDeactivated() -> bool;
|
||||
pub fn igIsItemDeactivatedAfterEdit() -> bool;
|
||||
pub fn igIsAnyItemHovered() -> bool;
|
||||
pub fn igIsAnyItemActive() -> bool;
|
||||
pub fn igIsAnyItemFocused() -> bool;
|
||||
pub fn igGetItemRectMin_nonUDT2() -> ImVec2;
|
||||
pub fn igGetItemRectMax_nonUDT2() -> ImVec2;
|
||||
pub fn igGetItemRectSize_nonUDT2() -> ImVec2;
|
||||
pub fn igSetItemAllowOverlap();
|
||||
pub fn igIsRectVisible(size: ImVec2) -> bool;
|
||||
pub fn igIsRectVisibleVec2(rect_min: ImVec2, rect_max: ImVec2) -> bool;
|
||||
pub fn igGetTime() -> c_double;
|
||||
pub fn igGetFrameCount() -> c_int;
|
||||
pub fn igGetOverlayDrawList() -> *mut ImDrawList;
|
||||
pub fn igGetDrawListSharedData() -> *mut ImDrawListSharedData;
|
||||
pub fn igGetStyleColorName(idx: ImGuiCol) -> *const c_char;
|
||||
pub fn igSetStateStorage(storage: *mut ImGuiStorage);
|
||||
pub fn igGetStateStorage() -> *mut ImGuiStorage;
|
||||
pub fn igCalcTextSize_nonUDT2(
|
||||
text: *const c_char,
|
||||
text_end: *const c_char,
|
||||
hide_text_after_double_hash: bool,
|
||||
wrap_width: c_float,
|
||||
) -> ImVec2;
|
||||
pub fn igCalcListClipping(
|
||||
items_count: c_int,
|
||||
items_height: c_float,
|
||||
out_items_display_start: *mut c_int,
|
||||
out_items_display_end: *mut c_int,
|
||||
);
|
||||
|
||||
pub fn igBeginChildFrame(id: ImGuiID, size: ImVec2, flags: ImGuiWindowFlags) -> bool;
|
||||
pub fn igEndChildFrame();
|
||||
|
||||
pub fn igColorConvertU32ToFloat4_nonUDT2(color: ImU32) -> ImVec4;
|
||||
pub fn igColorConvertFloat4ToU32(color: ImVec4) -> ImU32;
|
||||
pub fn igColorConvertRGBtoHSV(
|
||||
r: c_float,
|
||||
g: c_float,
|
||||
b: c_float,
|
||||
out_h: *mut c_float,
|
||||
out_s: *mut c_float,
|
||||
out_v: *mut c_float,
|
||||
);
|
||||
pub fn igColorConvertHSVtoRGB(
|
||||
h: c_float,
|
||||
s: c_float,
|
||||
v: c_float,
|
||||
out_r: *mut c_float,
|
||||
out_g: *mut c_float,
|
||||
out_b: *mut c_float,
|
||||
);
|
||||
}
|
||||
|
||||
// Inputs
|
||||
extern "C" {
|
||||
pub fn igGetKeyIndex(imgui_key: ImGuiKey) -> c_int;
|
||||
pub fn igIsKeyDown(user_key_index: c_int) -> bool;
|
||||
pub fn igIsKeyPressed(user_key_index: c_int, repeat: bool) -> bool;
|
||||
pub fn igIsKeyReleased(user_key_index: c_int) -> bool;
|
||||
pub fn igGetKeyPressedAmount(key_index: c_int, repeat_delay: c_float, rate: c_float) -> c_int;
|
||||
pub fn igIsMouseDown(button: c_int) -> bool;
|
||||
pub fn igIsAnyMouseDown() -> bool;
|
||||
pub fn igIsMouseClicked(button: c_int, repeat: bool) -> bool;
|
||||
pub fn igIsMouseDoubleClicked(button: c_int) -> bool;
|
||||
pub fn igIsMouseReleased(button: c_int) -> bool;
|
||||
pub fn igIsMouseDragging(button: c_int, lock_threshold: c_float) -> bool;
|
||||
pub fn igIsMouseHoveringRect(r_min: ImVec2, r_max: ImVec2, clip: bool) -> bool;
|
||||
pub fn igIsMousePosValid(mouse_pos: *const ImVec2) -> bool;
|
||||
pub fn igGetMousePos_nonUDT2() -> ImVec2;
|
||||
pub fn igGetMousePosOnOpeningCurrentPopup_nonUDT2() -> ImVec2;
|
||||
pub fn igGetMouseDragDelta_nonUDT2(button: c_int, lock_threshold: c_float) -> ImVec2;
|
||||
pub fn igResetMouseDragDelta(button: c_int);
|
||||
pub fn igGetMouseCursor() -> ImGuiMouseCursor;
|
||||
pub fn igSetMouseCursor(cursor: ImGuiMouseCursor);
|
||||
pub fn igCaptureKeyboardFromApp(capture: bool);
|
||||
pub fn igCaptureMouseFromApp(capture: bool);
|
||||
}
|
||||
|
||||
// Clipboard utilities
|
||||
extern "C" {
|
||||
pub fn igGetClipboardText() -> *const c_char;
|
||||
pub fn igSetClipboardText(text: *const c_char);
|
||||
}
|
||||
|
||||
// Settings/.Ini Utilities
|
||||
extern "C" {
|
||||
pub fn igLoadIniSettingsFromDisk(ini_filename: *const c_char);
|
||||
pub fn igLoadIniSettingsFromMemory(ini_data: *const c_char, ini_size: usize);
|
||||
pub fn igSaveIniSettingsToDisk(ini_filename: *const c_char);
|
||||
pub fn igSaveIniSettingsToMemory(out_ini_size: *const usize) -> *const c_char;
|
||||
}
|
||||
|
||||
// Memory Utilities
|
||||
extern "C" {
|
||||
pub fn igSetAllocatorFunctions(
|
||||
alloc_func: Option<extern "C" fn(sz: usize, user_data: *mut c_void) -> *mut c_void>,
|
||||
free_func: Option<extern "C" fn(ptr: *mut c_void, user_data: *mut c_void)>,
|
||||
user_data: *mut c_void,
|
||||
);
|
||||
pub fn igMemAlloc(size: usize) -> *mut c_void;
|
||||
pub fn igMemFree(ptr: *mut c_void);
|
||||
}
|
||||
1178
imgui-sys/src/lib.rs
1178
imgui-sys/src/lib.rs
File diff suppressed because it is too large
Load Diff
@ -191,24 +191,6 @@ pub struct ImFontGlyph {
|
||||
pub v1: c_float,
|
||||
}
|
||||
|
||||
/// Shared state of input text callback
|
||||
#[repr(C)]
|
||||
pub struct ImGuiInputTextCallbackData {
|
||||
pub event_flag: ImGuiInputTextFlags,
|
||||
pub flags: ImGuiInputTextFlags,
|
||||
pub user_data: *mut c_void,
|
||||
|
||||
pub event_char: ImWchar,
|
||||
pub event_key: ImGuiKey,
|
||||
pub buf: *mut c_char,
|
||||
pub buf_text_len: c_int,
|
||||
pub buf_size: c_int,
|
||||
pub buf_dirty: bool,
|
||||
pub cursor_pos: c_int,
|
||||
pub selection_start: c_int,
|
||||
pub selection_end: c_int,
|
||||
}
|
||||
|
||||
/// Main configuration and I/O between your application and ImGui
|
||||
#[repr(C)]
|
||||
pub struct ImGuiIO {
|
||||
@ -563,22 +545,6 @@ extern "C" {
|
||||
pub fn ImGuiStorage_BuildSortByKey(this: *mut ImGuiStorage);
|
||||
}
|
||||
|
||||
// ImGuiInputTextCallbackData
|
||||
extern "C" {
|
||||
pub fn ImGuiInputTextCallbackData_DeleteChars(
|
||||
this: *mut ImGuiInputTextCallbackData,
|
||||
pos: c_int,
|
||||
bytes_count: c_int,
|
||||
);
|
||||
pub fn ImGuiInputTextCallbackData_InsertChars(
|
||||
this: *mut ImGuiInputTextCallbackData,
|
||||
pos: c_int,
|
||||
text: *const c_char,
|
||||
text_end: *const c_char,
|
||||
);
|
||||
pub fn ImGuiInputTextCallbackData_HasSelection(this: *mut ImGuiInputTextCallbackData) -> bool;
|
||||
}
|
||||
|
||||
// ImGuiPayload
|
||||
extern "C" {
|
||||
pub fn ImGuiPayload_Clear(this: *mut ImGuiPayload);
|
||||
|
||||
2
imgui-sys/third-party/cimgui
vendored
2
imgui-sys/third-party/cimgui
vendored
@ -1 +1 @@
|
||||
Subproject commit 67f3b097a5090dd074be959fb9c794bd75096a1c
|
||||
Subproject commit 2b03f434d4afd5cae9d352035edc1fbfd1ac3c2d
|
||||
10
src/input.rs
10
src/input.rs
@ -135,9 +135,9 @@ macro_rules! impl_step_params {
|
||||
|
||||
extern "C" fn resize_callback(data: *mut sys::ImGuiInputTextCallbackData) -> c_int {
|
||||
unsafe {
|
||||
if (*data).event_flag == ImGuiInputTextFlags::CallbackResize {
|
||||
if let Some(buffer) = ((*data).user_data as *mut ImString).as_mut() {
|
||||
let requested_size = (*data).buf_size as usize;
|
||||
if (*data).EventFlag == ImGuiInputTextFlags::CallbackResize.bits() {
|
||||
if let Some(buffer) = ((*data).UserData as *mut ImString).as_mut() {
|
||||
let requested_size = (*data).BufSize as usize;
|
||||
if requested_size > buffer.capacity_with_nul() {
|
||||
// Refresh the buffer's length to take into account changes made by dear imgui.
|
||||
buffer.refresh_len();
|
||||
@ -145,8 +145,8 @@ extern "C" fn resize_callback(data: *mut sys::ImGuiInputTextCallbackData) -> c_i
|
||||
// After we're done we'll call refresh_len, so this won't be visible to the user.
|
||||
buffer.0.set_len(buffer.0.len() + 1);
|
||||
buffer.reserve(requested_size - buffer.0.len());
|
||||
(*data).buf = buffer.as_mut_ptr();
|
||||
(*data).buf_dirty = true;
|
||||
(*data).Buf = buffer.as_mut_ptr();
|
||||
(*data).BufDirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user