ui: Bug fix: Sizing also calls GLContext

This commit is contained in:
Hajime Hoshi 2016-07-24 05:29:47 +09:00
parent efe64d56f4
commit e118a755f5
5 changed files with 7 additions and 0 deletions

View File

@ -115,6 +115,7 @@ func Run(g GraphicsContext, width, height int, scale float64, title string, fps
if err := g.SetSize(e.Width, e.Height, e.ActualScale); err != nil {
return err
}
e.Done <- struct{}{}
case ui.CloseEvent:
return nil
case ui.RenderEvent:

View File

@ -21,6 +21,7 @@ type ScreenSizeEvent struct {
Width int
Height int
ActualScale float64
Done chan struct{}
}
type RenderEvent struct {

View File

@ -191,6 +191,7 @@ func (u *userInterface) Update() (interface{}, error) {
Width: u.width,
Height: u.height,
ActualScale: u.actualScreenScale(),
Done: make(chan struct{}, 1),
}
return nil
})

View File

@ -96,6 +96,7 @@ func (u *userInterface) Update() (interface{}, error) {
Width: w,
Height: h,
ActualScale: u.ActualScreenScale(),
Done: make(chan struct{}, 1),
}
return e, nil
}

View File

@ -83,11 +83,14 @@ func (u *userInterface) Terminate() error {
func (u *userInterface) Update() (interface{}, error) {
if u.sizeChanged {
// Sizing also calls GL functions
<-chRender
u.sizeChanged = false
e := ScreenSizeEvent{
Width: u.width,
Height: u.height,
ActualScale: u.actualScreenScale(),
Done: chRenderEnd,
}
return e, nil
}