Created
February 22, 2024 09:30
-
-
Save plutov/2f609223088d690a482401684e295f71 to your computer and use it in GitHub Desktop.
ebiten1.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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