Add f32 constructors for ImVec2/ImVec4

This commit is contained in:
Joonas Javanainen 2015-08-18 19:56:11 +03:00
parent 8c3c485cd5
commit d970e287d1

View File

@ -211,6 +211,15 @@ pub struct ImVec2 {
pub y: c_float
}
impl ImVec2 {
pub fn new(x: f32, y: f32) -> ImVec2 {
ImVec2 {
x: x as c_float,
y: y as c_float
}
}
}
#[repr(C)]
#[derive(Copy, Clone, Debug, Default)]
pub struct ImVec4 {
@ -220,6 +229,17 @@ pub struct ImVec4 {
pub w: c_float
}
impl ImVec4 {
pub fn new(x: f32, y: f32, z: f32, w: f32) -> ImVec4 {
ImVec4 {
x: x as c_float,
y: y as c_float,
z: z as c_float,
w: w as c_float
}
}
}
#[repr(C)]
pub struct ImGuiStyle {
pub alpha: c_float,