mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +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 {
|
if err := g.SetSize(e.Width, e.Height, e.ActualScale); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
e.Done <- struct{}{}
|
||||||
case ui.CloseEvent:
|
case ui.CloseEvent:
|
||||||
return nil
|
return nil
|
||||||
case ui.RenderEvent:
|
case ui.RenderEvent:
|
||||||
|
@ -21,6 +21,7 @@ type ScreenSizeEvent struct {
|
|||||||
Width int
|
Width int
|
||||||
Height int
|
Height int
|
||||||
ActualScale float64
|
ActualScale float64
|
||||||
|
Done chan struct{}
|
||||||
}
|
}
|
||||||
|
|
||||||
type RenderEvent struct {
|
type RenderEvent struct {
|
||||||
|
@ -191,6 +191,7 @@ func (u *userInterface) Update() (interface{}, error) {
|
|||||||
Width: u.width,
|
Width: u.width,
|
||||||
Height: u.height,
|
Height: u.height,
|
||||||
ActualScale: u.actualScreenScale(),
|
ActualScale: u.actualScreenScale(),
|
||||||
|
Done: make(chan struct{}, 1),
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
@ -96,6 +96,7 @@ func (u *userInterface) Update() (interface{}, error) {
|
|||||||
Width: w,
|
Width: w,
|
||||||
Height: h,
|
Height: h,
|
||||||
ActualScale: u.ActualScreenScale(),
|
ActualScale: u.ActualScreenScale(),
|
||||||
|
Done: make(chan struct{}, 1),
|
||||||
}
|
}
|
||||||
return e, nil
|
return e, nil
|
||||||
}
|
}
|
||||||
|
@ -83,11 +83,14 @@ func (u *userInterface) Terminate() error {
|
|||||||
|
|
||||||
func (u *userInterface) Update() (interface{}, error) {
|
func (u *userInterface) Update() (interface{}, error) {
|
||||||
if u.sizeChanged {
|
if u.sizeChanged {
|
||||||
|
// Sizing also calls GL functions
|
||||||
|
<-chRender
|
||||||
u.sizeChanged = false
|
u.sizeChanged = false
|
||||||
e := ScreenSizeEvent{
|
e := ScreenSizeEvent{
|
||||||
Width: u.width,
|
Width: u.width,
|
||||||
Height: u.height,
|
Height: u.height,
|
||||||
ActualScale: u.actualScreenScale(),
|
ActualScale: u.actualScreenScale(),
|
||||||
|
Done: chRenderEnd,
|
||||||
}
|
}
|
||||||
return e, nil
|
return e, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user