playground and object drawer skeleton
This commit is contained in:
@@ -15,5 +15,30 @@ func (e *Engine) PlaygroundUpdate() {
|
||||
}
|
||||
|
||||
func (e *Engine) PlaygroundDraw(screen *ebiten.Image) {
|
||||
e.Domain.GetLevel(e.KContext.CurrentLevel)
|
||||
e.PlaygroundBackgroundDraw(screen)
|
||||
e.PlaygroundObjectsDraw(screen)
|
||||
}
|
||||
|
||||
func (e *Engine) PlaygroundBackgroundDraw(screen *ebiten.Image) {
|
||||
playground := e.GetPlayground()
|
||||
render := playground.Render
|
||||
screen.DrawImage(e.GetImage(render), &ebiten.DrawImageOptions{})
|
||||
}
|
||||
|
||||
func (e *Engine) PlaygroundObjectsDraw(screen *ebiten.Image) {
|
||||
playground := e.GetPlayground()
|
||||
geoM := ebiten.GeoM{}
|
||||
for _, object := range playground.Objects {
|
||||
render := object.Type.Render
|
||||
geoM.Reset()
|
||||
geoM.Translate(float64(object.Position.X), float64(object.Position.Y))
|
||||
screen.DrawImage(e.GetImage(render), &ebiten.DrawImageOptions{
|
||||
GeoM: geoM,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Engine) GetPlayground() entity.Playground {
|
||||
level := e.Domain.GetLevel(e.KContext.CurrentLevel)
|
||||
return level.Playgrounds[e.KContext.CurrentPlayground]
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package entity
|
||||
|
||||
type KContext struct {
|
||||
ScreenType ScreenType
|
||||
ScreenValue string
|
||||
CurrentLevel int
|
||||
Players []Player
|
||||
ScreenType ScreenType
|
||||
ScreenValue string
|
||||
CurrentLevel int
|
||||
CurrentPlayground int
|
||||
Players []Player
|
||||
}
|
||||
|
||||
func (c *KContext) getPrimaryPlayer() Player {
|
||||
|
||||
@@ -14,6 +14,7 @@ type KeyMap struct {
|
||||
type ScreenSettings struct {
|
||||
Width int
|
||||
Height int
|
||||
Scale int
|
||||
}
|
||||
|
||||
type Settings struct {
|
||||
|
||||
Reference in New Issue
Block a user