feat: initial commit with M1-M4 implementation
This commit is contained in:
44
cmd/game/main.go
Normal file
44
cmd/game/main.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/soer/football/internal/game"
|
||||
"github.com/soer/football/internal/render"
|
||||
"github.com/hajimehoshi/ebiten/v2"
|
||||
"log"
|
||||
)
|
||||
|
||||
type Game struct {
|
||||
world *game.World
|
||||
renderer *render.Renderer
|
||||
}
|
||||
|
||||
func (g *Game) Update() error {
|
||||
g.world.Update()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g *Game) Draw(screen *ebiten.Image) {
|
||||
g.renderer.DrawWorld(screen, g.world)
|
||||
}
|
||||
|
||||
func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
|
||||
return 1280, 720
|
||||
}
|
||||
|
||||
func main() {
|
||||
ebiten.SetWindowSize(1280, 720)
|
||||
ebiten.SetWindowTitle("AI Hockey Simulation")
|
||||
|
||||
g := &Game{
|
||||
world: game.NewWorld(),
|
||||
renderer: render.NewRenderer(),
|
||||
}
|
||||
|
||||
// Give the puck some initial velocity to see it move
|
||||
g.world.Puck.Velocity.X = 2
|
||||
g.world.Puck.Velocity.Y = 1.5
|
||||
|
||||
if err := ebiten.RunGame(g); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user