ui: Remove Terminate

This commit is contained in:
Hajime Hoshi 2016-09-02 01:07:41 +09:00
parent 6da16aa1a0
commit 453c2c4589
5 changed files with 6 additions and 22 deletions

View File

@ -112,10 +112,6 @@ func Run(g GraphicsContext, width, height int, scale float64, title string, fps
if err := ui.CurrentUI().Start(width, height, scale, title); err != nil { if err := ui.CurrentUI().Start(width, height, scale, title); err != nil {
return err return err
} }
// TODO: Use the error value
defer func() {
_ = ui.CurrentUI().Terminate()
}()
n := now() n := now()
currentRunContext.lastUpdated = n currentRunContext.lastUpdated = n

View File

@ -21,7 +21,6 @@ type GraphicsContext interface {
type UserInterface interface { type UserInterface interface {
Start(width, height int, scale float64, title string) error Start(width, height int, scale float64, title string) error
Terminate() error
AnimationFrameLoop(g GraphicsContext) error AnimationFrameLoop(g GraphicsContext) error
ScreenScale() float64 ScreenScale() float64
SetScreenSize(width, height int) (bool, error) SetScreenSize(width, height int) (bool, error)

View File

@ -241,15 +241,13 @@ func (u *userInterface) update(g GraphicsContext) error {
return nil return nil
} }
func (u *userInterface) Terminate() error { func (u *userInterface) AnimationFrameLoop(g GraphicsContext) error {
defer func() {
_ = u.runOnMainThread(func() error { _ = u.runOnMainThread(func() error {
glfw.Terminate() glfw.Terminate()
return nil return nil
}) })
return nil }()
}
func (u *userInterface) AnimationFrameLoop(g GraphicsContext) error {
for { for {
if err := u.update(g); err != nil { if err := u.update(g); err != nil {
return err return err

View File

@ -87,11 +87,6 @@ func (u *userInterface) update(g GraphicsContext) error {
return nil return nil
} }
func (u *userInterface) Terminate() error {
// Do nothing.
return nil
}
func (u *userInterface) AnimationFrameLoop(g GraphicsContext) error { func (u *userInterface) AnimationFrameLoop(g GraphicsContext) error {
ch := make(chan error) ch := make(chan error)
var f func() var f func()

View File

@ -77,10 +77,6 @@ func (u *userInterface) Start(width, height int, scale float64, title string) er
return nil return nil
} }
func (u *userInterface) Terminate() error {
return nil
}
func (u *userInterface) AnimationFrameLoop(g GraphicsContext) error { func (u *userInterface) AnimationFrameLoop(g GraphicsContext) error {
for { for {
if u.sizeChanged { if u.sizeChanged {