mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-14 23:18:28 +00:00
Handle new FontGlyph bitfields
This commit is contained in:
parent
41ac160bd8
commit
f93389178b
@ -5,7 +5,7 @@ use crate::sys;
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct FontGlyph {
|
||||
pub codepoint: u16,
|
||||
bitfields: u32,
|
||||
pub advance_x: f32,
|
||||
pub x0: f32,
|
||||
pub y0: f32,
|
||||
@ -17,6 +17,21 @@ pub struct FontGlyph {
|
||||
pub v1: f32,
|
||||
}
|
||||
|
||||
impl FontGlyph {
|
||||
pub fn codepoint(&self) -> u32 {
|
||||
unsafe { self.raw().Codepoint() }
|
||||
}
|
||||
pub fn set_codepoint(&mut self, codepoint: u32) {
|
||||
unsafe { self.raw_mut().set_Codepoint(codepoint) };
|
||||
}
|
||||
pub fn visible(&self) -> bool {
|
||||
unsafe { self.raw().Visible() != 0 }
|
||||
}
|
||||
pub fn set_visible(&mut self, visible: bool) {
|
||||
unsafe { self.raw_mut().set_Visible(visible as u32) }
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl RawCast<sys::ImFontGlyph> for FontGlyph {}
|
||||
|
||||
#[test]
|
||||
@ -37,7 +52,7 @@ fn test_font_glyph_memory_layout() {
|
||||
assert_eq!(offset_of!(FontGlyph, $l), offset_of!(ImFontGlyph, $r));
|
||||
};
|
||||
};
|
||||
assert_field_offset!(codepoint, Codepoint);
|
||||
assert_field_offset!(bitfields, _bitfield_1);
|
||||
assert_field_offset!(advance_x, AdvanceX);
|
||||
assert_field_offset!(x0, X0);
|
||||
assert_field_offset!(y0, Y0);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user