mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
ui: Refactoring on mobile
This commit is contained in:
parent
453c2c4589
commit
93a994f1d6
@ -79,24 +79,32 @@ func (u *userInterface) Start(width, height int, scale float64, title string) er
|
|||||||
|
|
||||||
func (u *userInterface) AnimationFrameLoop(g GraphicsContext) error {
|
func (u *userInterface) AnimationFrameLoop(g GraphicsContext) error {
|
||||||
for {
|
for {
|
||||||
if u.sizeChanged {
|
if err := u.update(g); err != nil {
|
||||||
// Sizing also calls GL functions
|
|
||||||
<-chRender
|
|
||||||
u.sizeChanged = false
|
|
||||||
if err := g.SetSize(u.width, u.height, u.actualScreenScale()); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
chRenderEnd <- struct{}{}
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
<-chRender
|
|
||||||
if err := g.Update(); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
chRenderEnd <- struct{}{}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (u *userInterface) update(g GraphicsContext) error {
|
||||||
|
<-chRender
|
||||||
|
defer func() {
|
||||||
|
chRenderEnd <- struct{}{}
|
||||||
|
}()
|
||||||
|
|
||||||
|
if u.sizeChanged {
|
||||||
|
// Sizing also calls GL functions
|
||||||
|
u.sizeChanged = false
|
||||||
|
if err := g.SetSize(u.width, u.height, u.actualScreenScale()); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if err := g.Update(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (u *userInterface) SetScreenSize(width, height int) (bool, error) {
|
func (u *userInterface) SetScreenSize(width, height int) (bool, error) {
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
return false, nil
|
return false, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user