41 lines
658 B
Go
41 lines
658 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/hajimehoshi/ebiten/v2"
|
|
"github.com/hajimehoshi/ebiten/v2/ebitenutil"
|
|
"log"
|
|
)
|
|
|
|
type Game struct {
|
|
counter int
|
|
}
|
|
|
|
func (g *Game) Update() error {
|
|
return nil
|
|
}
|
|
|
|
func newGame() *Game {
|
|
return &Game{
|
|
counter: 1,
|
|
}
|
|
}
|
|
|
|
func (g *Game) Draw(screen *ebiten.Image) {
|
|
ebitenutil.DebugPrint(screen, fmt.Sprintf("Counter: %d", g.counter))
|
|
g.counter++
|
|
}
|
|
|
|
func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
|
|
return 320, 240
|
|
}
|
|
|
|
func main() {
|
|
game := newGame()
|
|
ebiten.SetWindowSize(480, 320)
|
|
ebiten.SetWindowTitle("Go CHIP8 Emulator")
|
|
if err := ebiten.RunGame(game); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|