cleanup
build rgb-board / build (push) Successful in 8m47s Details

main
Nathan Wagner 11 months ago
parent 476ed823bc
commit 1093a2c1b2

@ -54,7 +54,7 @@ func (a *Animation) animateMario() {
defer a.updateMarioPosition()
a.ctx.SetColor(color.Black)
a.ctx.Clear()
if a.dir.X == 1 {
if a.mario.dir.X == 1 {
a.ctx.DrawImageAnchored(a.mario.images[a.mario.updown], a.mario.position.X, a.mario.position.Y, 0.5, 0.5)
} else {
a.ctx.DrawImageAnchored(imaging.FlipH(a.mario.images[a.mario.updown]), a.mario.position.X, a.mario.position.Y, 0.5, 0.5)
@ -69,7 +69,7 @@ func (a *Animation) updateMarioPosition() {
if a.mario.position.Y+a.height > a.ctx.Height() {
a.mario.dir.Y = -1
a.mario.updown = "marioUp"
} else if a.position.Y-a.height < 0 {
} else if a.mario.position.Y-a.height < 0 {
a.mario.updown = "marioDown"
a.mario.dir.Y = 1
}

@ -14,16 +14,13 @@ import (
type Animation struct {
ctx *gg.Context
position image.Point
dir image.Point
height int
width int
stroke int
updown string
mqmsg chan mqtt.Message
msg string
mario Mario
countDown int
mario Mario
doorbell Doorbell
}
@ -35,11 +32,9 @@ func orchestrator(tk *rgbmatrix.ToolKit, mqMessages chan mqtt.Message) {
func animate(sz image.Point, mqMessages chan mqtt.Message) *Animation {
return &Animation{
ctx: gg.NewContext(sz.X, sz.Y),
dir: image.Point{1, 1},
height: 8,
width: 8,
stroke: 8,
updown: "marioUp",
mqmsg: mqMessages,
countDown: 5000,
mario: Mario{

Loading…
Cancel
Save