diff options
author | jonas <himself@jonasgunz.de> | 2019-01-22 10:49:21 +0100 |
---|---|---|
committer | jonas <himself@jonasgunz.de> | 2019-01-22 10:49:21 +0100 |
commit | 072e6b2901c046d80284fa72af2513fe9d8df997 (patch) | |
tree | c359805b11a2f88e7144192d546dde8fd3046802 /cRender.cpp | |
parent | c1186bf65902f47a2d618280384bce700a688ec1 (diff) | |
download | termgl-072e6b2901c046d80284fa72af2513fe9d8df997.tar.gz |
Fixed Issue #5: cRender:drawLine() now also fills lines with |gradient| > 1
Diffstat (limited to 'cRender.cpp')
-rw-r--r-- | cRender.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/cRender.cpp b/cRender.cpp index 293901b..f563199 100644 --- a/cRender.cpp +++ b/cRender.cpp @@ -118,15 +118,22 @@ int cRender::drawLine(char _c, sPos _pos1, sPos _pos2, bool _overrideCollision, if(abs(fGradient) > 1) { int dy = (int)(((i + 1) * fGradient + _pos1.y + 0.5) - (i * fGradient + _pos1.y + 0.5)); - if(abs(dy) > 0) + + if(dy > 0 && ((int)(i * fGradient + _pos1.y + 0.5) + dy) <= _pos2.y) { 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}, + sPos{i + _pos1.x, (int)(i * fGradient + _pos1.y + 0.5) + dy }, _overrideCollision, _color); }//if + else if(dy < 0 && ((int)(i * fGradient + _pos1.y + 0.5) + dy) >= (_pos2.y) ) + { + drawLine(_c, + sPos{i + _pos1.x, (int)(i * fGradient + _pos1.y + 0.5) + dy }, + sPos{i + _pos1.x, (int)(i * fGradient + _pos1.y + 0.5)}, + _overrideCollision, _color); + }//else if }//if - }//for }//else |