From 57c9687d64a6e4f90276e93797758a875555a401 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Mon, 21 Jan 2019 20:09:06 +0100 Subject: Begin Issue #5 --- cRender.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cRender.cpp b/cRender.cpp index 41908e1..1b3b08d 100644 --- a/cRender.cpp +++ b/cRender.cpp @@ -114,6 +114,18 @@ int cRender::drawLine(char _c, sPos _pos1, sPos _pos2, bool _overrideCollision, for (int i = 0; i <= abs(dX); i++) { drawPoint(_c, sPos{i + _pos1.x, (int)(i * fGradient + _pos1.y + 0.5)}, _overrideCollision, _color); //+0.5 for rounding error + + if(abs(fGradient) > 1) + { + int dy = (int)(((i + 1) * fGradient + _pos1.y + 0.5) - (i * fGradient + _pos1.y + 0.5)); + if(abs(dy) > 0) + { + drawLine(_c, + sPos{i + _pos1.x, (int)(i * fGradient + _pos1.y + 0.5)}, + sPos{i + _pos1.x, (int)(i * fGradient + _pos1.y + 0.5) + dy}, + _overrideCollision, _color); + } + } } } -- cgit v1.2.3