]> git.itanic.dy.fi Git - sdl-planets/commitdiff
draw_planet: Add support for drawing the tree area
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Sat, 17 Apr 2010 14:16:44 +0000 (17:16 +0300)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Sat, 17 Apr 2010 14:21:23 +0000 (17:21 +0300)
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
planet.c

index 99e6e312bcae1870f5686acd1566c9bbd4275c51..fae7086e78dcef3cb083b5af758875adb17a3dcf 100644 (file)
--- a/planet.c
+++ b/planet.c
@@ -8,6 +8,7 @@ struct quadtree_ops planet_ops;
 int gravitations, optimizations;
 
 static int draw_lines = 0;
+static int draw_tree_area = 0;
 
 static void putpixel(struct SDL_Surface *screen, const int x, const int y,
                     const unsigned char r, const unsigned char g,
@@ -185,6 +186,10 @@ void draw_planet(SDL_Surface *screen, const struct planet *p,
        pos.x += screen->w / 2;
        pos.y += screen->h / 2;
 
+       if (draw_tree_area)
+               draw_circle(screen, &pos, p->tree_area * cam->zoom,
+                           p->r / 8, p->g / 8, p->b / 8, 1);
+
        if (draw_lines) {
                for (i = 0; i < 4; i++) {
                        if (!p->tree.child[i])