slages / love-imgui

imgui module for the LÖVE game engine
MIT License
321 stars 61 forks source link

Add: functionality to change default font to one of the preloaded fonts at runtime #32

Closed gdinit closed 5 years ago

gdinit commented 5 years ago

As per title, this commit adds functionality to change default font to one of the preloaded fonts at runtime.

Usage: imgui.SetDefaultFontLua(".", fontIndex)

pseudo code Here is a gist showing how I'm using it at the moment (excerpt from actual much longer main.lua): https://gist.github.com/gdinit/92e29769954b28a25d2dbe067c1a03f2#file-main-lua-L112

slages commented 5 years ago

Hi gdinit,

Thanks for the pull! So far I've never edited the imgui code for the bindings and I would prefer to keep it this way. And actually it would be best to implement it by making PushFont available.

The idea would be to transform SetGlobalFontFromFileTTF to something more generic like AddFontFromFileTTF, and maybe returning an ID to be used for PushFont.

gdinit commented 5 years ago

Hello slages, Thanks for your response. I understand the concern. I will close this PR then. The method you described sounds fine also, I do hope it gets implemented some time not too distant.