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