mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-27 03:02:49 +01:00
parent
a70d6a314e
commit
01a1334639
@ -28,7 +28,11 @@ type Game struct {
|
|||||||
input Input
|
input Input
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Game) Update(r *ebiten.Image) error {
|
func (g *Game) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int) {
|
||||||
|
return ScreenWidth, ScreenHeight
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *Game) Update(*ebiten.Image) error {
|
||||||
if g.sceneManager == nil {
|
if g.sceneManager == nil {
|
||||||
g.sceneManager = &SceneManager{}
|
g.sceneManager = &SceneManager{}
|
||||||
g.sceneManager.GoTo(&TitleScene{})
|
g.sceneManager.GoTo(&TitleScene{})
|
||||||
@ -38,10 +42,9 @@ func (g *Game) Update(r *ebiten.Image) error {
|
|||||||
if err := g.sceneManager.Update(&g.input); err != nil {
|
if err := g.sceneManager.Update(&g.input); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if ebiten.IsDrawingSkipped() {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
g.sceneManager.Draw(r)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (g *Game) Draw(screen *ebiten.Image) {
|
||||||
|
g.sceneManager.Draw(screen)
|
||||||
|
}
|
||||||
|
@ -41,9 +41,9 @@ func main() {
|
|||||||
defer pprof.StopCPUProfile()
|
defer pprof.StopCPUProfile()
|
||||||
}
|
}
|
||||||
|
|
||||||
game := &blocks.Game{}
|
ebiten.SetWindowSize(blocks.ScreenWidth*2, blocks.ScreenHeight*2)
|
||||||
update := game.Update
|
ebiten.SetWindowTitle("Blocks (Ebiten Demo)")
|
||||||
if err := ebiten.Run(update, blocks.ScreenWidth, blocks.ScreenHeight, 2, "Blocks (Ebiten Demo)"); err != nil {
|
if err := ebiten.RunGame(&blocks.Game{}); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user