logic layer
This commit is contained in:
@@ -1,26 +1,25 @@
|
||||
package konstructor
|
||||
|
||||
import (
|
||||
"image/color"
|
||||
|
||||
"github.com/hajimehoshi/ebiten"
|
||||
)
|
||||
|
||||
type GameEngine struct {
|
||||
Konstructor Konstructor
|
||||
type Engine struct {
|
||||
Konstructor *Konstructor
|
||||
Logic *Logic
|
||||
}
|
||||
|
||||
func (g *GameEngine) Update(screen *ebiten.Image) error {
|
||||
func (g *Engine) Layout(outsideWidth, outsideHeight int) (int, int) {
|
||||
return g.Konstructor.Settings.Screen.Width, g.Konstructor.Settings.Screen.Height
|
||||
}
|
||||
|
||||
func (g *Engine) Update(screen *ebiten.Image) error {
|
||||
g.Konstructor.Controller.Watch()
|
||||
g.Logic.Update(screen)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g *GameEngine) Draw(screen *ebiten.Image) {
|
||||
if g.Konstructor.Controller.UpPressed() {
|
||||
screen.Fill(color.White)
|
||||
}
|
||||
}
|
||||
|
||||
func (g *GameEngine) Layout(outsideWidth, outsideHeight int) (int, int) {
|
||||
return g.Konstructor.Settings.Screen.Width, g.Konstructor.Settings.Screen.Height
|
||||
func (g *Engine) Draw(screen *ebiten.Image) {
|
||||
g.Logic.Draw(screen)
|
||||
g.Konstructor.Controller.Clear()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user