diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-11-17 19:44:09 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-11-17 19:44:09 (GMT) |
| commit | 058a2edd75debbd0297f92572316daa704bd379f (patch) | |
| tree | ad303f091f9a08b209b91eb34a9fcad996a3de69 /src/game/Brush.cpp | |
| parent | e3594aba9e05c6865d396418c028049cda92c2f3 (diff) | |
| parent | 7a21ae192fe19868539956f3fe28e62b2c7c4429 (diff) | |
| download | powder-058a2edd75debbd0297f92572316daa704bd379f.zip powder-058a2edd75debbd0297f92572316daa704bd379f.tar.gz | |
Merge branch 'master' of github.com:FacialTurd/PowderToypp
Diffstat (limited to 'src/game/Brush.cpp')
| -rw-r--r-- | src/game/Brush.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/game/Brush.cpp b/src/game/Brush.cpp new file mode 100644 index 0000000..38dd809 --- /dev/null +++ b/src/game/Brush.cpp @@ -0,0 +1,48 @@ +#include "Brush.h" +#include "graphics/Renderer.h" + +void Brush::RenderRect(Renderer * ren, ui::Point position1, ui::Point position2) +{ + int width, height, t; + width = position2.X-position1.X; + height = position2.Y-position1.Y; + if(height<0) + { + position1.Y += height; + height *= -1; + } + if(width<0) + { + position1.X += width; + width *= -1; + } + + ren->xor_line(position1.X, position1.Y, position1.X+width, position1.Y); + if(height>0){ + ren->xor_line(position1.X, position1.Y+height, position1.X+width, position1.Y+height); + if(height>1){ + ren->xor_line(position1.X+width, position1.Y+1, position1.X+width, position1.Y+height-1); + if(width>0) + ren->xor_line(position1.X, position1.Y+1, position1.X, position1.Y+height-1); + } + } +} + +void Brush::RenderLine(Renderer * ren, ui::Point position1, ui::Point position2) +{ + ren->xor_line(position1.X, position1.Y, position2.X, position2.Y); +} + +void Brush::RenderPoint(Renderer * ren, ui::Point position) +{ + if(!outline) + updateOutline(); + if(!outline) + return; + ren->xor_bitmap(outline, position.X-radius.X, position.Y-radius.Y, size.X, size.Y); +} + +void Brush::RenderFill(Renderer * ren, ui::Point position) +{ + +} |
