diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-07-28 12:09:35 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-07-28 12:09:35 (GMT) |
| commit | f9eeebb91039d88ceb7e4cf4e4aecf374d77e633 (patch) | |
| tree | f6efdfcd4189a8c5b2fb483ecb8737633d71461c /src/game/Brush.cpp | |
| parent | 30b11a7724c20bb3cf09a9dd67ee7ea39093c44b (diff) | |
| download | powder-f9eeebb91039d88ceb7e4cf4e4aecf374d77e633.zip powder-f9eeebb91039d88ceb7e4cf4e4aecf374d77e633.tar.gz | |
Draw brush using renderer, fixes issue #25
Diffstat (limited to 'src/game/Brush.cpp')
| -rw-r--r-- | src/game/Brush.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/game/Brush.cpp b/src/game/Brush.cpp new file mode 100644 index 0000000..e52febb --- /dev/null +++ b/src/game/Brush.cpp @@ -0,0 +1,42 @@ +#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); + ren->xor_line(position1.X, position1.Y+height, position1.X+width, position1.Y+height); + ren->xor_line(position1.X+width, position1.Y+1, position1.X+width, position1.Y+height-1); + 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) +{ + +}
\ No newline at end of file |
