Skip to content

Instantly share code, notes, and snippets.

@plutov
Created February 22, 2024 09:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plutov/2f609223088d690a482401684e295f71 to your computer and use it in GitHub Desktop.
Save plutov/2f609223088d690a482401684e295f71 to your computer and use it in GitHub Desktop.
ebiten1.go
package snake
import (
"fmt"
"image/color"
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/ebitenutil"
)
const (
ScreenWidth = 600
ScreenHeight = 600
boardRows = 20
boardCols = 20
)
var (
backgroundColor = color.RGBA{50, 100, 50, 50}
)
type Game struct {}
func NewGame() *Game {
return &Game{}
}
func (g *Game) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int) {
return ScreenWidth, ScreenHeight
}
func (g *Game) Update() error {
// todo
return nil
}
func (g *Game) Draw(screen *ebiten.Image) {
screen.Fill(backgroundColor)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment