mirror of
https://github.com/bloeys/nmage.git
synced 2025-12-29 05:18:21 +00:00
Return imgui font after set
This commit is contained in:
@ -134,17 +134,18 @@ func (i *ImguiInfo) Render(winWidth, winHeight float32, fbWidth, fbHeight int32)
|
||||
gl.Enable(gl.DEPTH_TEST)
|
||||
}
|
||||
|
||||
func (i *ImguiInfo) SetFontTTF(fontPath string, fontSize float32) {
|
||||
func (i *ImguiInfo) AddFontTTF(fontPath string, fontSize float32) imgui.Font {
|
||||
|
||||
imIO := imgui.CurrentIO()
|
||||
|
||||
a := imIO.Fonts()
|
||||
a.AddFontFromFileTTF(fontPath, fontSize)
|
||||
f := a.AddFontFromFileTTF(fontPath, fontSize)
|
||||
image := a.TextureDataAlpha8()
|
||||
|
||||
gl.BindTexture(gl.TEXTURE_2D, i.texID)
|
||||
gl.TexImage2D(gl.TEXTURE_2D, 0, gl.RED, int32(image.Width), int32(image.Height), 0, gl.RED, gl.UNSIGNED_BYTE, image.Pixels)
|
||||
imIO.Fonts().SetTextureID(imgui.TextureID(i.texID))
|
||||
|
||||
return f
|
||||
}
|
||||
|
||||
func NewImGUI() ImguiInfo {
|
||||
|
||||
Reference in New Issue
Block a user