diff --git a/audio/vorbis/decode.go b/audio/vorbis/decode.go index a491c8e80..437d03851 100644 --- a/audio/vorbis/decode.go +++ b/audio/vorbis/decode.go @@ -27,6 +27,7 @@ import ( "github.com/jfreymuth/go-vorbis/ogg/vorbis" ) +// Stream is a decoded audio stream. type Stream struct { buf *bytes.Reader } @@ -60,14 +61,17 @@ func newStream(v *vorbis.Vorbis) (*Stream, error) { return s, nil } +// Read is implementation of io.Reader's Read. func (s *Stream) Read(p []byte) (int, error) { return s.buf.Read(p) } +// Seek is implementation of io.Seeker's Seek. func (s *Stream) Seek(offset int64, whence int) (int64, error) { return s.buf.Seek(offset, whence) } +// Read is implementation of io.Closer's Close. func (s *Stream) Close() error { s.buf = nil return nil diff --git a/audio/wav/decode.go b/audio/wav/decode.go index 33b6f492e..a16704ef4 100644 --- a/audio/wav/decode.go +++ b/audio/wav/decode.go @@ -23,16 +23,19 @@ import ( "github.com/hajimehoshi/ebiten/audio" ) +// Stream is a decoded audio stream. type Stream struct { src audio.ReadSeekCloser headerSize int64 dataSize int64 } +// Read is implementation of io.Reader's Read. func (s *Stream) Read(p []byte) (int, error) { return s.src.Read(p) } +// Seek is implementation of io.Seeker's Seek. func (s *Stream) Seek(offset int64, whence int) (int64, error) { if whence == 0 { offset += s.headerSize @@ -40,6 +43,7 @@ func (s *Stream) Seek(offset int64, whence int) (int64, error) { return s.src.Seek(offset, whence) } +// Read is implementation of io.Closer's Close. func (s *Stream) Close() error { return s.src.Close() } diff --git a/ebitenutil/debugprint.go b/ebitenutil/debugprint.go index 39926079c..efb2eb565 100644 --- a/ebitenutil/debugprint.go +++ b/ebitenutil/debugprint.go @@ -59,8 +59,9 @@ type debugPrintState struct { var defaultDebugPrintState = &debugPrintState{} -func DebugPrint(r *ebiten.Image, str string) error { - return defaultDebugPrintState.DebugPrint(r, str) +// DebugPrint draws the string str on the image. +func DebugPrint(image *ebiten.Image, str string) error { + return defaultDebugPrintState.DebugPrint(image, str) } func (d *debugPrintState) drawText(rt *ebiten.Image, str string, x, y int, c color.Color) { diff --git a/ebitenutil/io.go b/ebitenutil/io.go index 4e5c23f67..9f5197123 100644 --- a/ebitenutil/io.go +++ b/ebitenutil/io.go @@ -18,6 +18,7 @@ import ( "io" ) +// ReadSeekCloser is io.ReadSeeker and io.Closer. type ReadSeekCloser interface { io.ReadSeeker io.Closer diff --git a/graphics.go b/graphics.go index 19fe241b7..f357340ad 100644 --- a/graphics.go +++ b/graphics.go @@ -22,8 +22,11 @@ import ( type Filter int const ( - FilterNearest Filter = iota // nearest (crisp-edged) filter - FilterLinear // linear filter + // FilterNearest represents nearest (crisp-edged) filter + FilterNearest Filter = iota + + // FilterLinear represents linear filter + FilterLinear ) func glFilter(filter Filter) opengl.Filter { diff --git a/input.go b/input.go index 3321efaab..2e64e23a8 100644 --- a/input.go +++ b/input.go @@ -82,11 +82,13 @@ func IsGamepadButtonPressed(id int, button GamepadButton) bool { return ui.CurrentInput().IsGamepadButtonPressed(id, ui.GamepadButton(button)) } +// Touch represents a pointer state. type Touch interface { ID() int Position() (x, y int) } +// Touches returns the current touch states. func Touches() []Touch { t := ui.CurrentInput().Touches() tt := make([]Touch, len(t))