From a9231fc038db548b7734608f3a5aaecab96e4f4b Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Sun, 12 Sep 2021 15:23:25 -0700 Subject: [PATCH] SDL2 engine: DrawLine: Use actual SDL call instead of IterLine --- sdl/canvas.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sdl/canvas.go b/sdl/canvas.go index 3c0f328..5665622 100644 --- a/sdl/canvas.go +++ b/sdl/canvas.go @@ -24,9 +24,10 @@ func (r *Renderer) DrawPoint(color render.Color, point render.Point) { // DrawLine draws a line between two points. func (r *Renderer) DrawLine(color render.Color, a, b render.Point) { - for pt := range render.IterLine(a, b) { - r.DrawPoint(color, pt) + if color != r.lastColor { + r.renderer.SetDrawColor(color.Red, color.Green, color.Blue, color.Alpha) } + r.renderer.DrawLine(int32(a.X), int32(a.Y), int32(b.X), int32(b.Y)) } // DrawRect draws a rectangle.