AllenDang / giu

Cross platform rapid GUI framework for golang based on Dear ImGui.
MIT License
2.11k stars 127 forks source link

setTheme() override callback/disablement #773

Open Chillance opened 4 months ago

Chillance commented 4 months ago

Related problem

No response

Your request

I was going through the code to see what is going on "under the hood" and found the setTheme method that is run every frame. Now, it might not matter much, but I still wanted to bring it up and see what you say.

If I want to change Theme/Style this setTheme will still always run and thus waste CPU time. I suppose I can set the style so that is good, and no callback would be needed for being able to set the theme, but that means it would still do this internal one and then override with my style. Seems a bit wasteful doing the internal one in this case. So, maybe introduce a way to have a callback for it, override with a custom one, and/or just disable the internal one?

Best Regards!

Alternative solution

No response

Additional context

No response

gucio321 commented 4 months ago

yeah, Thats a good idea.

However its not my highest priority right now as I need to re-enable all features that was disabled since migration (e.g. Markdown support) and this needs much work in cimgui-go.

Chillance commented 4 months ago

Yeah, understandable. Thoughts on how you see this implemented? Override with callback? Disable/Enable? Having it there is not bad, but a boolean to do it or not at least would be nice.

gucio321 commented 4 months ago

I think callback will be fine. If user wants to keep defaults, they can just pass empty function.