house.h

Go to the documentation of this file.
00001 // Class Name: house
00002 //
00003 // Purpose:
00004 //
00005 //   Provides a simple drawable object that has a roof, a body, two windows,
00006 //   and a door.
00007 //
00008 // Model:
00009 //
00010 //   The origin for this object refers to the bottom left corner of the
00011 //   body of the house (meaning that the left roof is drawn at a position
00012 //   relatively negative to the house origin).
00013 //
00014 // Methods:
00015 //
00016 //   house(origin, draw_on)
00017 //       The constructor accepts an "origin" for the house and a target
00018 //       window to "draw_on".
00019 //
00020 //   draw()
00021 //       Plots the house on its current canvas.
00022 //
00023 //   erase()
00024 //       Draws the house in its current canvas's background color.
00025 //
00026 //   dimensions()
00027 //       Returns a rectangle bounding the entire space used by the house.
00028 //       NOTE: the origin is actually inside the dimensions(), not at the
00029 //       bottom left.
00030 //
00031 //   height()
00032 //       Returns the height of the house in pixels.
00033 //
00034 //   width()
00035 //       Returns the width of the house in pixels.
00036 //
00037 //   set_origin(origin)
00038 //       Sets a new origin for the house with respect to its current canvas.
00039 //
00040 //   set_canvas(draw_on)
00041 //       Connects the house to a new canvas for drawing.
00042 
00043 #ifndef HOUSE_CLASS
00044 #define HOUSE_CLASS
00045 
00046 #include "fill_box.h"
00047 #include "visiline.h"
00048 
00049 class house
00050 {
00051 public:
00052   house(const c_point &origin = c_point(0, 0), canvas *draw_on = NIL);
00053 
00054   void draw();
00055   void erase();
00056 
00057   c_rectangle dimensions();
00058   int height();
00059   int width();
00060 
00061   void set_origin(const c_point &origin);
00062   void set_canvas(canvas *draw_on);
00063 
00064 private:
00065   visible_line left_roof;
00066   visible_line right_roof;
00067   visible_line roof_base;
00068   filled_box house_body;
00069   filled_box win_1;
00070   filled_box win_2;
00071   filled_box door;
00072   c_point my_origin;
00073   canvas *my_canvas;
00074 };
00075 
00076 #endif

Generated on Fri Nov 28 04:29:34 2008 for HOOPLE Libraries by  doxygen 1.5.1