mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
examples: Update comments
This commit is contained in:
parent
c279d0c1cf
commit
537bdb29f8
@ -70,15 +70,10 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Ebiten_png))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -36,15 +36,10 @@ const (
|
||||
var ebitenImage *ebiten.Image
|
||||
|
||||
func init() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Ebiten_png))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -46,15 +46,10 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Gophers_jpg))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -79,15 +79,10 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Ebiten_png))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -65,15 +65,10 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Runner_png))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -122,15 +122,10 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Ebiten_png))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -70,15 +70,10 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.FiveYears_jpg))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -53,15 +53,10 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Tiles_png))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -73,15 +73,10 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Gophers_jpg))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -89,15 +89,10 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Gophers_jpg))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -192,15 +192,10 @@ type Game struct {
|
||||
var ebitenImage *ebiten.Image
|
||||
|
||||
func init() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Ebiten_png))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -66,15 +66,10 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Ebiten_png))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -91,15 +91,10 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Ebiten_png))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -43,15 +43,10 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Gophers_jpg))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -139,15 +139,10 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Gophers_jpg))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -65,15 +65,10 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Gophers_jpg))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -39,15 +39,10 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Tile_png))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -43,15 +43,10 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img1, _, err := image.Decode(bytes.NewReader(rmascot.Out01_png))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -42,15 +42,10 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Gophers_jpg))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -98,15 +98,10 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Gophers_jpg))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -39,15 +39,10 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Gophers_jpg))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -46,15 +46,10 @@ const (
|
||||
var smokeImage *ebiten.Image
|
||||
|
||||
func init() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Smoke_png))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -70,15 +70,10 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Gophers_jpg))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -47,15 +47,10 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Tile_png))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -70,15 +70,10 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Gophers_jpg))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -42,15 +42,10 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(resources.Gopher_png))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -42,15 +42,10 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Ebiten_png))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -44,15 +44,10 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Ebiten_png))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -44,15 +44,10 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Tiles_png))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -229,15 +229,10 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Gophers_jpg))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -46,15 +46,10 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.UI_png))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -377,15 +377,10 @@ func main() {
|
||||
w, h := ebiten.ScreenSizeInFullscreen()
|
||||
fmt.Printf("Screen size in fullscreen: %d, %d\n", w, h)
|
||||
|
||||
// Decode image from a byte slice instead of a file so that
|
||||
// this example works in any working directory.
|
||||
// If you want to use a file, there are some options:
|
||||
// 1) Use os.Open and pass the file to the image decoder.
|
||||
// This is a very regular way, but doesn't work on browsers.
|
||||
// 2) Use ebitenutil.OpenFile and pass the file to the image decoder.
|
||||
// This works even on browsers.
|
||||
// 3) Use ebitenutil.NewImageFromFile to create an ebiten.Image directly from a file.
|
||||
// This also works on browsers.
|
||||
// Decode an image from a byte slice.
|
||||
// Now this image file's byte slice is generated with //go:generated for Go 1.15 or older.
|
||||
// If you use Go 1.16 or newer, it is strongly recommended to use //go:embed to embed the image file.
|
||||
// See https://pkg.go.dev/embed for more details.
|
||||
img, _, err := image.Decode(bytes.NewReader(images.Gophers_jpg))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
Loading…
Reference in New Issue
Block a user