handle error from glfw.Init

This commit is contained in:
faiface 2016-11-25 23:26:27 +01:00
parent 0fe2df4620
commit 2f7af40ce6
1 changed files with 4 additions and 2 deletions

View File

@ -73,7 +73,10 @@ func NewWindow(config WindowConfig) (*Window, error) {
w := &Window{config: config}
err := pixelgl.DoErr(func() error {
glfw.Init()
err := glfw.Init()
if err != nil {
return err
}
glfw.WindowHint(glfw.ContextVersionMajor, 3)
glfw.WindowHint(glfw.ContextVersionMinor, 3)
@ -87,7 +90,6 @@ func NewWindow(config WindowConfig) (*Window, error) {
glfw.WindowHint(glfw.Maximized, bool2int[config.Maximized])
glfw.WindowHint(glfw.Samples, config.MSAASamples)
var err error
w.window, err = glfw.CreateWindow(int(config.Width), int(config.Height), config.Title, nil, nil)
if err != nil {
return err