constructor stucture fixes

This commit is contained in:
2023-06-30 17:44:19 +02:00
parent dec8ad2fe0
commit 0ed8cfb839
6 changed files with 63 additions and 53 deletions

View File

@@ -1,33 +1,26 @@
package constructor
import (
"game/domain"
"image/color"
"github.com/hajimehoshi/ebiten"
)
const (
screenWidth = 320
screenHeight = 240
)
type GameEngine struct {
Context domain.Context
Keyboard Keyboard
Constructor Constructor
}
func (g *GameEngine) Update(screen *ebiten.Image) error {
g.Keyboard.Watch()
g.Constructor.Controller.Watch()
return nil
}
func (g *GameEngine) Draw(screen *ebiten.Image) {
if g.Keyboard.UpPressed() {
if g.Constructor.Controller.UpPressed() {
screen.Fill(color.White)
}
}
func (g *GameEngine) Layout(outsideWidth, outsideHeight int) (int, int) {
return screenWidth, screenHeight
return g.Constructor.GameSettings.ScreenSettings.Width, g.Constructor.GameSettings.ScreenSettings.Height
}