44 lines
718 B
Go
44 lines
718 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/hajimehoshi/ebiten/v2"
|
|
"github.com/hajimehoshi/ebiten/v2/ebitenutil"
|
|
)
|
|
|
|
type Game struct{}
|
|
|
|
var _ ebiten.Game = (*Game)(nil)
|
|
|
|
func (g *Game) Update() error {
|
|
return nil
|
|
}
|
|
|
|
func (g *Game) Draw(screen *ebiten.Image) {
|
|
ebitenutil.DebugPrint(screen, "Hello, World!")
|
|
}
|
|
|
|
const (
|
|
screenWidth = 320
|
|
screenHeight = 240
|
|
)
|
|
|
|
//nolint:nonamedreturns
|
|
func (g *Game) Layout(_, _ int) (_screenWidth, _screenHeight int) {
|
|
return screenWidth, screenHeight
|
|
}
|
|
|
|
const (
|
|
windowWidth = 640
|
|
windowHeight = 480
|
|
)
|
|
|
|
func main() {
|
|
ebiten.SetWindowSize(windowWidth, windowHeight)
|
|
ebiten.SetWindowTitle("Hello, World!")
|
|
if err := ebiten.RunGame(&Game{}); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|