mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
ui: Remove FinishRendering
This commit is contained in:
parent
8121b2102f
commit
eb8e8b6034
@ -158,10 +158,6 @@ func Run(g GraphicsContext, width, height, scale int, title string, fps int) err
|
||||
beforeForUpdate += int64(tt) * int64(time.Second) / int64(fps)
|
||||
frames++
|
||||
}
|
||||
if err := ui.CurrentUI().FinishRendering(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Calc the current FPS.
|
||||
if time.Second <= time.Duration(n2-beforeForFPS) {
|
||||
fps := float64(frames) * float64(time.Second) / float64(n2-beforeForFPS)
|
||||
@ -169,6 +165,7 @@ func Run(g GraphicsContext, width, height, scale int, title string, fps int) err
|
||||
beforeForFPS = n2
|
||||
frames = 0
|
||||
}
|
||||
e.Done <- struct{}{}
|
||||
case ui.PauseEvent:
|
||||
if err := g.Pause(); err != nil {
|
||||
return err
|
||||
|
@ -25,6 +25,7 @@ type ScreenSizeEvent struct {
|
||||
}
|
||||
|
||||
type RenderEvent struct {
|
||||
Done chan struct{}
|
||||
}
|
||||
|
||||
type PauseEvent struct {
|
||||
|
@ -18,7 +18,6 @@ type UserInterface interface {
|
||||
Start(width, height, scale int, title string) error
|
||||
Update() (interface{}, error)
|
||||
SwapBuffers() error
|
||||
FinishRendering() error
|
||||
Terminate() error
|
||||
ScreenScale() int
|
||||
SetScreenSize(width, height int) bool
|
||||
|
@ -230,7 +230,9 @@ func (u *userInterface) Update() (interface{}, error) {
|
||||
if ferr != nil {
|
||||
return nil, ferr
|
||||
}
|
||||
return RenderEvent{}, nil
|
||||
// Dummy channel
|
||||
ch := make(chan struct{}, 1)
|
||||
return RenderEvent{ch}, nil
|
||||
}
|
||||
|
||||
func (u *userInterface) Terminate() error {
|
||||
|
@ -92,7 +92,9 @@ func (u *userInterface) Update() (interface{}, error) {
|
||||
}
|
||||
return e, nil
|
||||
}
|
||||
return RenderEvent{}, nil
|
||||
// Dummy channel
|
||||
ch := make(chan struct{}, 1)
|
||||
return RenderEvent{ch}, nil
|
||||
}
|
||||
|
||||
func (u *userInterface) Terminate() error {
|
||||
|
@ -144,7 +144,7 @@ func (u *userInterface) Update() (interface{}, error) {
|
||||
chPauseStart <- struct{}{}
|
||||
return PauseEvent{chPauseEnd}, nil
|
||||
case <-chRender:
|
||||
return RenderEvent{}, nil
|
||||
return RenderEvent{chRenderEnd}, nil
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,11 +152,6 @@ func (u *userInterface) SwapBuffers() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u *userInterface) FinishRendering() error {
|
||||
chRenderEnd <- struct{}{}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u *userInterface) SetScreenSize(width, height int) bool {
|
||||
// TODO: Implement
|
||||
return false
|
||||
|
Loading…
Reference in New Issue
Block a user