mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-23 17:32:02 +01:00
parent
841085863b
commit
1f9cc53ce4
@ -319,19 +319,32 @@ func outputKeyRectsGo(k map[ebiten.Key]image.Rectangle) error {
|
|||||||
|
|
||||||
var regularTermination = errors.New("regular termination")
|
var regularTermination = errors.New("regular termination")
|
||||||
|
|
||||||
func main() {
|
type game struct {
|
||||||
var rects map[ebiten.Key]image.Rectangle
|
rects map[ebiten.Key]image.Rectangle
|
||||||
if err := ebiten.Run(func(_ *ebiten.Image) error {
|
}
|
||||||
|
|
||||||
|
func (g *game) Update(_ *ebiten.Image) error {
|
||||||
var err error
|
var err error
|
||||||
rects, err = outputKeyboardImage()
|
g.rects, err = outputKeyboardImage()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return regularTermination
|
return regularTermination
|
||||||
}, 256, 256, 1, ""); err != regularTermination {
|
}
|
||||||
|
|
||||||
|
func (g *game) Draw(_ *ebiten.Image) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *game) Layout(outw, outh int) (int, int) {
|
||||||
|
return 256, 256
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
g := &game{}
|
||||||
|
if err := ebiten.RunGame(g); err != regularTermination {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
if err := outputKeyRectsGo(rects); err != nil {
|
if err := outputKeyRectsGo(g.rects); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user