mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
graphics: Clarify when ebiten.Run returns error (#331)
This commit is contained in:
parent
a3e14c9ddb
commit
6b70adf23b
@ -126,6 +126,7 @@ func (i *imageImpl) At(x, y int, context *opengl.Context) color.Color {
|
||||
if i.restorable == nil {
|
||||
return color.Transparent
|
||||
}
|
||||
// TODO: Error should be delayed until flushing. Do not panic here.
|
||||
clr, err := i.restorable.At(x, y, context)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
6
run.go
6
run.go
@ -63,13 +63,15 @@ var theGraphicsContext atomic.Value
|
||||
// f is a function which is called at every frame.
|
||||
// The argument (*Image) is the render target that represents the screen.
|
||||
//
|
||||
// This function must be called from the main thread.
|
||||
// Run must be called from the main thread.
|
||||
// Note that ebiten bounds the main goroutine to the main OS thread by runtime.LockOSThread.
|
||||
//
|
||||
// The given function f is guaranteed to be called 60 times a second
|
||||
// even if a rendering frame is skipped.
|
||||
// f is not called when the screen is not shown.
|
||||
// If f returns error, this function returns the same error.
|
||||
//
|
||||
// Run returns error when 1) OpenGL error happens, or 2) f returns error.
|
||||
// In the case of 2), Run returns the same error.
|
||||
//
|
||||
// The size unit is device-independent pixel.
|
||||
func Run(f func(*Image) error, width, height int, scale float64, title string) error {
|
||||
|
Loading…
Reference in New Issue
Block a user