internal/ui: refactoring

This commit is contained in:
Hajime Hoshi 2022-07-12 12:47:34 +09:00
parent d4e1787154
commit e05df6a778
2 changed files with 3 additions and 13 deletions

View File

@ -30,8 +30,6 @@ import (
"github.com/hajimehoshi/ebiten/v2/internal/hooks" "github.com/hajimehoshi/ebiten/v2/internal/hooks"
) )
const DefaultTPS = clock.DefaultTPS
type Game interface { type Game interface {
NewOffscreenImage(width, height int) *Image NewOffscreenImage(width, height int) *Image
Layout(outsideWidth, outsideHeight int) (int, int) Layout(outsideWidth, outsideHeight int) (int, int)
@ -353,14 +351,6 @@ func SetFPSMode(fpsMode FPSModeType) {
theUI.SetFPSMode(fpsMode) theUI.SetFPSMode(fpsMode)
} }
func TPS() int {
return clock.TPS()
}
func SetTPS(tps int) {
clock.SetTPS(tps)
}
func IsScreenClearedEveryFrame() bool { func IsScreenClearedEveryFrame() bool {
return theGlobalState.isScreenClearedEveryFrame() return theGlobalState.isScreenClearedEveryFrame()
} }

6
run.go
View File

@ -76,7 +76,7 @@ type Game interface {
} }
// DefaultTPS represents a default ticks per second, that represents how many times game updating happens in a second. // DefaultTPS represents a default ticks per second, that represents how many times game updating happens in a second.
const DefaultTPS = ui.DefaultTPS const DefaultTPS = clock.DefaultTPS
// CurrentFPS returns the current number of FPS (frames per second), that represents // CurrentFPS returns the current number of FPS (frames per second), that represents
// how many swapping buffer happens per second. // how many swapping buffer happens per second.
@ -417,7 +417,7 @@ func ScheduleFrame() {
// //
// MaxTPS is concurrent-safe. // MaxTPS is concurrent-safe.
func MaxTPS() int { func MaxTPS() int {
return ui.TPS() return clock.TPS()
} }
// CurrentTPS returns the current TPS (ticks per second), // CurrentTPS returns the current TPS (ticks per second),
@ -447,7 +447,7 @@ const UncappedTPS = SyncWithFPS
// //
// SetMaxTPS is concurrent-safe. // SetMaxTPS is concurrent-safe.
func SetMaxTPS(tps int) { func SetMaxTPS(tps int) {
ui.SetTPS(tps) clock.SetTPS(tps)
} }
// IsScreenTransparent reports whether the window is transparent. // IsScreenTransparent reports whether the window is transparent.