mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
ui: Bug fix: Sizing also calls GLContext
This commit is contained in:
parent
efe64d56f4
commit
e118a755f5
@ -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:
|
||||
|
@ -21,6 +21,7 @@ type ScreenSizeEvent struct {
|
||||
Width int
|
||||
Height int
|
||||
ActualScale float64
|
||||
Done chan struct{}
|
||||
}
|
||||
|
||||
type RenderEvent struct {
|
||||
|
@ -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
|
||||
})
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user