SDL2 engine: DrawLine: Use actual SDL call instead of IterLine

master
Noah 2021-09-12 15:23:25 -07:00
parent d77f5056b7
commit a9231fc038
1 changed files with 3 additions and 2 deletions

View File

@ -24,9 +24,10 @@ func (r *Renderer) DrawPoint(color render.Color, point render.Point) {
// DrawLine draws a line between two points. // DrawLine draws a line between two points.
func (r *Renderer) DrawLine(color render.Color, a, b render.Point) { func (r *Renderer) DrawLine(color render.Color, a, b render.Point) {
for pt := range render.IterLine(a, b) { if color != r.lastColor {
r.DrawPoint(color, pt) 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. // DrawRect draws a rectangle.