giu
giu copied to clipboard
[bug]g.Context.FontAtlas.SetDefaultFontSize can't invoke before g.NewMasterWindow
What happend?
g.Context is nil
panic: runtime error: invalid memory address or nil pointer dereference
Code example
main.go
package main
import ( g "github.com/AllenDang/giu" )
func loop() { g.SingleWindow().Layout( g.Style().To( g.Label("test"), ), ) } func main() { g.Context.FontAtlas.SetDefaultFontSize(12) wnd := g.NewMasterWindow("test", 1024, 768, g.MasterWindowFlagsMaximized) wnd.Run(loop) }
To Reproduce
- Run my demo
- will see the crash...
Version
master
OS
windows
While the help message say to do so.
// SetDefaultFontSize sets the default font size. Invoke this before MasterWindow.NewMasterWindow(..).
You're right - something is borken inside font atlas right now... SetDefaultFontSize
doesn't work anyhow :smile:
ok, I see - context is nil because it is created in NewMasterWindow. THe problem is that init font stuff happens there as well. Need to add extra logic in SetDefaultFontSize.