Closed ruby3141 closed 8 months ago
Found out latter one was actually working. \ There was a unrelated mistake elsewhere and I didn't found it before writing this.
It doesn't seems like right approach to me tho...
ImguiRenderLoop
needs to be Send
and Sync
as we do not have further information about the threads it may be called upon. This makes it impossible to store raw pointers in there.
You do not need to necessarily hold on to that pointer directly. You can just hold on to the index in the font atlas and retrieve the font on each frame like you are doing above. If you really want to hold on to the FontId
, you can unsafely implement Send
and Sync
for your structure.
This is how I do this myself:
https://github.com/veeenu/darksoulsiii-practice-tool/blob/master/practice-tool/src/practice_tool.rs#L23-L30 https://github.com/veeenu/darksoulsiii-practice-tool/blob/master/practice-tool/src/practice_tool.rs#L479
Thank you for kind answer.
Try loading font on
ImguiRenderLoop.initialize()
and holdingFontId
on ImguiRenderLoop struct and got this kind of compile error.Also tried to get
FontId
fromui.fonts().fonts()
but it doesn't work. (regardless of the index value)How can I load my font and use it? I spend about a day finding solution but ran out of idea.