diff --git a/doc.go b/doc.go index db51d67c3..107266931 100644 --- a/doc.go +++ b/doc.go @@ -50,8 +50,9 @@ // } // // In the API document, 'the main thread' means the goroutine in init(), main() and their callees without 'go' -// statement. It is assured that 'the main thread' runs on the OS main thread. There are some Ebiten functions that -// must be called on the main thread under some conditions (typically, before ebiten.RunGame is called). +// statement. It is assured that 'the main thread' runs on the OS main thread. There are some Ebiten functions (e.g., +// DeviceScaleFactor) that must be called on the main thread under some conditions (typically, before ebiten.RunGame +// is called). // // Environment variables // @@ -72,5 +73,6 @@ // `ebitengl` forces to use OpenGL in any environments. // // `ebitensinglethread` disables Ebiten's thread safety to unlock maximum performance. If you use this you will have -// to manage threads yourself. Functions like IsKeyPressed will no longer be concurrent-safe with this build tag. +// to manage threads yourself. Functions like IsKeyPressed will no longer be concurrent-safe with this build tag and +// must be called from the main thread. package ebiten diff --git a/internal/thread/thread.go b/internal/thread/thread.go index 08c8edf51..caa89f4a2 100644 --- a/internal/thread/thread.go +++ b/internal/thread/thread.go @@ -18,7 +18,7 @@ import ( "errors" ) -// Thread defines threading behavior in ebiten. +// Thread defines threading behavior in Ebiten. type Thread interface { Call(func() error) error Loop() diff --git a/run.go b/run.go index 5de69fc24..355108aac 100644 --- a/run.go +++ b/run.go @@ -297,7 +297,8 @@ func SetRunnableOnUnfocused(runnableOnUnfocused bool) { // DeviceScaleFactor might panic on init function on some devices like Android. // Then, it is not recommended to call DeviceScaleFactor from init functions. // -// DeviceScaleFactor must be called on the main thread before the main loop, and is concurrent-safe after the main loop. +// DeviceScaleFactor must be called on the main thread before the main loop, and is concurrent-safe after the main +// loop. func DeviceScaleFactor() float64 { return uiDriver().DeviceScaleFactor() }