Advertisement
Guest User

Untitled

a guest
Jan 4th, 2014
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 2.92 KB | None | 0 0
  1. // waid\graphics\space.d
  2. // written by beta69
  3. module waid.graphics.space;
  4.  
  5. import core.sys.windows.windows;
  6.  
  7. public class Point
  8. {
  9. private:
  10.     int _x;
  11.     int _y;
  12.     int _z;
  13. public:
  14.     this(int x = 0, int y = 0, int z = 0)
  15.     {
  16.         _x = x;
  17.         _y = y;
  18.         _z = z;
  19.     }
  20.    
  21.     @property
  22.     {
  23.         int X()
  24.         {
  25.             return _x;
  26.         }
  27.         void X(int value)
  28.         {
  29.             _x = value;
  30.         }
  31.        
  32.         int Y()
  33.         {
  34.             return _y;
  35.         }
  36.         void Y(int value)
  37.         {
  38.             _y = value;
  39.         }
  40.        
  41.         int Z()
  42.         {
  43.             return _z;
  44.         }
  45.         void Z(int value)
  46.         {
  47.             _z = value;
  48.         }
  49.     }
  50. }
  51.  
  52. public class Capacity
  53. {
  54. private:
  55.     int w;
  56.     int h;
  57.     int d;
  58. public:
  59.     this(int width = 0, int height = 0, int depth = 0)
  60.     {
  61.         w = width;
  62.         h = height;
  63.         d = depth;
  64.     }
  65.    
  66.     @property
  67.     {
  68.         int Width()
  69.         {
  70.             return w;
  71.         }
  72.         void Width(int value)
  73.         {
  74.             w = value;
  75.         }
  76.        
  77.         int Height()
  78.         {
  79.             return h;
  80.         }
  81.         void Height(int value)
  82.         {
  83.             h = value;
  84.         }
  85.        
  86.         int Depth()
  87.         {
  88.             return d;
  89.         }
  90.         void Depth(int value)
  91.         {
  92.             d = value;
  93.         }
  94.     }
  95. }
  96.  
  97. public class Rectangle
  98. {
  99. private:
  100.     Point _loc;
  101.     Capacity _size;
  102. public:
  103.     this(int x, int y, int z, Capacity size)
  104.     {
  105.         this(new Point(x, y, z), size);
  106.     }
  107.     this(Point loc, int width, int height, int depth)
  108.     {
  109.         this(loc, new Capacity(width, height, depth));
  110.     }
  111.     this(int x, int y, Capacity size)
  112.     {
  113.         this(new Point(x, y), size);
  114.     }
  115.     this(Point loc, int width, int height)
  116.     {
  117.         this(loc, new Capacity(width, height));
  118.     }  
  119.     this(int x, int y, int width, int height)
  120.     {
  121.         this(new Point(x, y), new Capacity(width, height));
  122.     }
  123.     this(int x, int  y, int z, int width, int height, int depth)
  124.     {
  125.         this(new Point(x, y, z), new Capacity(width, height, depth));
  126.     }
  127.     this(Point loc, Capacity size)
  128.     {
  129.         _loc = loc;
  130.         _size = size;
  131.     }
  132.    
  133.     @property
  134.     {
  135.         Point Location()
  136.         {
  137.             return _loc;
  138.         }
  139.         void Location(Point value)
  140.         {
  141.             _loc = value;
  142.         }
  143.        
  144.         Capacity Size()
  145.         {
  146.             return _size;
  147.         }
  148.         void Size(Capacity value)
  149.         {
  150.             _size = value;
  151.         }
  152.        
  153.         int X()
  154.         {
  155.             return _loc.X;
  156.         }
  157.         void X(int value)
  158.         {
  159.             _loc.X = value;
  160.         }
  161.        
  162.         int Y()
  163.         {
  164.             return _loc.Y;
  165.         }
  166.         void Y(int value)
  167.         {
  168.             _loc.Y = value;
  169.         }
  170.        
  171.         int Z()
  172.         {
  173.             return _loc.Z;
  174.         }
  175.         void Z(int value)
  176.         {
  177.             _loc.Z = value;
  178.         }
  179.        
  180.         int Width()
  181.         {
  182.             return _size.Width;
  183.         }
  184.         void Width(int value)
  185.         {
  186.             _size.Width = value;
  187.         }
  188.        
  189.         int Height()
  190.         {
  191.             return _size.Height;
  192.         }
  193.         void Height(int value)
  194.         {
  195.             _size.Height = value;
  196.         }
  197.        
  198.         int Depth()
  199.         {
  200.             return _size.Depth;
  201.         }
  202.         void Depth(int value)
  203.         {
  204.             _size.Depth = value;
  205.         }
  206.        
  207.         int Left()
  208.         {
  209.             return X;
  210.         }
  211.        
  212.         int Top()
  213.         {
  214.             return Y;
  215.         }
  216.        
  217.         int Right()
  218.         {
  219.             return X + Width;
  220.         }
  221.        
  222.         int Bottom()
  223.         {
  224.             return Y + Height;
  225.         }
  226.     }
  227.    
  228.     RECT toRECT()
  229.     {
  230.         RECT rect;
  231.         rect.left = Left;
  232.         rect.top = Top;
  233.         rect.right = Right;
  234.         rect.bottom = Bottom;
  235.        
  236.         return rect;
  237.     }
  238. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement