Skip to content

Commit

Permalink
Add f32 constructors for ImVec2/ImVec4
Browse files Browse the repository at this point in the history
  • Loading branch information
Gekkio committed Aug 18, 2015
1 parent 8c3c485 commit d970e28
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
Expand Down

0 comments on commit d970e28

Please sign in to comment.