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

This commit is contained in:
Noah 2021-09-12 15:23:25 -07:00
parent d77f5056b7
commit a9231fc038

View File

@ -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.