Merge pull request #355 from N3xed/master

Fixed `SharedFontAtlas` not being used
This commit is contained in:
Joonas Javanainen 2020-09-03 00:19:32 +03:00 committed by GitHub
commit 66260c123b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -209,9 +209,18 @@ impl Context {
no_current_context(),
"A new active context cannot be created, because another one already exists"
);
let shared_font_atlas_ptr = match &shared_font_atlas {
Some(shared_font_atlas) => {
let borrowed_font_atlas = shared_font_atlas.borrow();
borrowed_font_atlas.0
}
None => ptr::null_mut(),
};
// Dear ImGui implicitly sets the current context during igCreateContext if the current
// context doesn't exist
let raw = unsafe { sys::igCreateContext(ptr::null_mut()) };
let raw = unsafe { sys::igCreateContext(shared_font_atlas_ptr) };
Context {
raw,
shared_font_atlas,

View File

@ -409,7 +409,7 @@ pub struct FontAtlasTexture<'a> {
/// A font atlas that can be shared between contexts
#[derive(Debug)]
pub struct SharedFontAtlas(*mut sys::ImFontAtlas);
pub struct SharedFontAtlas(pub(crate) *mut sys::ImFontAtlas);
impl SharedFontAtlas {
pub fn create() -> SharedFontAtlas {