1#![allow(non_upper_case_globals)]
30#![allow(non_camel_case_types)]
31#![allow(non_snake_case)]
32#![allow(dead_code)]
33#![allow(unnecessary_transmutes)]
34#![allow(clippy::all)]
35#![allow(unpredictable_function_pointer_comparisons)]
38
39mod ffi;
42pub use ffi::*;
43
44pub use ImColor as Color;
53pub use ImVec2 as Vector2;
54pub use ImVec4 as Vector4;
55
56pub const IMGUI_VERSION: &str = env!("CARGO_PKG_VERSION");
58
59pub const HAS_DOCKING: bool = true;
61
62#[cfg(feature = "freetype")]
64pub const HAS_FREETYPE: bool = true;
65
66#[cfg(not(feature = "freetype"))]
67pub const HAS_FREETYPE: bool = false;
68
69#[cfg(feature = "wasm")]
71pub const HAS_WASM: bool = true;
72
73#[cfg(not(feature = "wasm"))]
74pub const HAS_WASM: bool = false;
75
76impl ImVec2 {
79 #[inline]
80 pub const fn new(x: f32, y: f32) -> ImVec2 {
81 ImVec2 { x, y }
82 }
83
84 #[inline]
85 pub const fn zero() -> ImVec2 {
86 ImVec2 { x: 0.0, y: 0.0 }
87 }
88}
89
90impl From<[f32; 2]> for ImVec2 {
91 #[inline]
92 fn from(array: [f32; 2]) -> ImVec2 {
93 ImVec2::new(array[0], array[1])
94 }
95}
96
97impl From<(f32, f32)> for ImVec2 {
98 #[inline]
99 fn from((x, y): (f32, f32)) -> ImVec2 {
100 ImVec2::new(x, y)
101 }
102}
103
104impl From<ImVec2> for [f32; 2] {
105 #[inline]
106 fn from(v: ImVec2) -> [f32; 2] {
107 [v.x, v.y]
108 }
109}
110
111impl From<ImVec2> for (f32, f32) {
112 #[inline]
113 fn from(v: ImVec2) -> (f32, f32) {
114 (v.x, v.y)
115 }
116}
117
118impl From<mint::Vector2<f32>> for ImVec2 {
119 #[inline]
120 fn from(v: mint::Vector2<f32>) -> ImVec2 {
121 ImVec2::new(v.x, v.y)
122 }
123}
124
125#[cfg(feature = "glam")]
126impl From<glam::Vec2> for ImVec2 {
127 #[inline]
128 fn from(v: glam::Vec2) -> ImVec2 {
129 ImVec2::new(v.x, v.y)
130 }
131}
132
133impl ImVec4 {
134 #[inline]
135 pub const fn new(x: f32, y: f32, z: f32, w: f32) -> ImVec4 {
136 ImVec4 { x, y, z, w }
137 }
138
139 #[inline]
140 pub const fn zero() -> ImVec4 {
141 ImVec4 {
142 x: 0.0,
143 y: 0.0,
144 z: 0.0,
145 w: 0.0,
146 }
147 }
148}
149
150impl From<[f32; 4]> for ImVec4 {
151 #[inline]
152 fn from(array: [f32; 4]) -> ImVec4 {
153 ImVec4::new(array[0], array[1], array[2], array[3])
154 }
155}
156
157impl From<(f32, f32, f32, f32)> for ImVec4 {
158 #[inline]
159 fn from((x, y, z, w): (f32, f32, f32, f32)) -> ImVec4 {
160 ImVec4::new(x, y, z, w)
161 }
162}
163
164impl From<ImVec4> for [f32; 4] {
165 #[inline]
166 fn from(v: ImVec4) -> [f32; 4] {
167 [v.x, v.y, v.z, v.w]
168 }
169}
170
171impl From<ImVec4> for (f32, f32, f32, f32) {
172 #[inline]
173 fn from(v: ImVec4) -> (f32, f32, f32, f32) {
174 (v.x, v.y, v.z, v.w)
175 }
176}
177
178impl From<mint::Vector4<f32>> for ImVec4 {
179 #[inline]
180 fn from(v: mint::Vector4<f32>) -> ImVec4 {
181 ImVec4::new(v.x, v.y, v.z, v.w)
182 }
183}
184
185#[cfg(feature = "glam")]
186impl From<glam::Vec4> for ImVec4 {
187 #[inline]
188 fn from(v: glam::Vec4) -> ImVec4 {
189 ImVec4::new(v.x, v.y, v.z, v.w)
190 }
191}