change IMDraw properties to fields

This commit is contained in:
faiface 2017-05-18 23:50:45 +02:00
parent b86a3db7b8
commit d8c9a533fa
3 changed files with 9 additions and 9 deletions

View File

@ -43,9 +43,9 @@ func (cl *colorlight) apply(dst pixel.ComposeTarget, center pixel.Vec, src, nois
// create the light arc if not created already
if cl.imd == nil {
imd := imdraw.New(nil)
imd.Color(pixel.Alpha(1))
imd.Color = pixel.Alpha(1)
imd.Push(0)
imd.Color(pixel.Alpha(0))
imd.Color = pixel.Alpha(0)
for angle := -cl.spread / 2; angle <= cl.spread/2; angle += cl.spread / 64 {
imd.Push(pixel.X(1).Rotated(angle))
}

View File

@ -86,7 +86,7 @@ type platform struct {
}
func (p *platform) draw(imd *imdraw.IMDraw) {
imd.Color(p.color)
imd.Color = p.color
imd.Push(p.rect.Min, p.rect.Max)
imd.Rectangle(0)
}
@ -247,7 +247,7 @@ func (g *goal) update(dt float64) {
func (g *goal) draw(imd *imdraw.IMDraw) {
for i := len(g.cols) - 1; i >= 0; i-- {
imd.Color(g.cols[i])
imd.Color = g.cols[i]
imd.Push(g.pos)
imd.Circle(float64(i+1)*g.radius/float64(len(g.cols)), 0)
}
@ -324,7 +324,7 @@ func run() {
canvas := pixelgl.NewCanvas(pixel.R(-160/2, -120/2, 160/2, 120/2))
imd := imdraw.New(sheet)
imd.Precision(32)
imd.Precision = 32
camPos := pixel.V(0, 0)

View File

@ -39,28 +39,28 @@ func run() {
// red circle
imd.Clear()
imd.Color(pixel.RGB(1, 0, 0))
imd.Color = pixel.RGB(1, 0, 0)
imd.Push(win.Bounds().Center() - pixel.X(offset))
imd.Circle(200, 0)
imd.Draw(canvas)
// blue circle
imd.Clear()
imd.Color(pixel.RGB(0, 0, 1))
imd.Color = pixel.RGB(0, 0, 1)
imd.Push(win.Bounds().Center() + pixel.X(offset))
imd.Circle(150, 0)
imd.Draw(canvas)
// yellow circle
imd.Clear()
imd.Color(pixel.RGB(1, 1, 0))
imd.Color = pixel.RGB(1, 1, 0)
imd.Push(win.Bounds().Center() - pixel.Y(offset))
imd.Circle(100, 0)
imd.Draw(canvas)
// magenta circle
imd.Clear()
imd.Color(pixel.RGB(1, 0, 1))
imd.Color=pixel.RGB(1, 0, 1)
imd.Push(win.Bounds().Center() + pixel.Y(offset))
imd.Circle(50, 0)
imd.Draw(canvas)