2021-07-14 16:14:32 +10:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2021-07-14 16:26:47 +10:00
|
|
|
"fmt"
|
2021-07-14 16:14:32 +10:00
|
|
|
"image/color"
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"github.com/hajimehoshi/ebiten/v2"
|
2021-07-14 16:26:47 +10:00
|
|
|
"github.com/hajimehoshi/ebiten/v2/ebitenutil"
|
2021-07-14 16:14:32 +10:00
|
|
|
)
|
|
|
|
|
|
|
|
const screenWidth, screenHeight = 320, 240
|
|
|
|
|
|
|
|
type game struct{}
|
|
|
|
|
|
|
|
func (g *game) Update() error {
|
|
|
|
// TODO
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (g *game) Draw(screen *ebiten.Image) {
|
2021-07-14 16:26:47 +10:00
|
|
|
screen.Fill(color.RGBA{50, 50, 50, 255})
|
|
|
|
ebitenutil.DebugPrint(screen, fmt.Sprintf("TPS: %0.2f", ebiten.CurrentTPS()))
|
2021-07-14 16:14:32 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
func (g *game) Layout(outsideWidth, outsideHeight int) (w, h int) {
|
|
|
|
return screenWidth, screenHeight
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
ebiten.SetWindowSize(screenWidth*2, screenHeight*2)
|
|
|
|
ebiten.SetWindowTitle("ebiten")
|
|
|
|
if err := ebiten.RunGame(&game{}); err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|