Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // waid\graphics\space.d
- // written by beta69
- module waid.graphics.space;
- import core.sys.windows.windows;
- public class Point
- {
- private:
- int _x;
- int _y;
- int _z;
- public:
- this(int x = 0, int y = 0, int z = 0)
- {
- _x = x;
- _y = y;
- _z = z;
- }
- @property
- {
- int X()
- {
- return _x;
- }
- void X(int value)
- {
- _x = value;
- }
- int Y()
- {
- return _y;
- }
- void Y(int value)
- {
- _y = value;
- }
- int Z()
- {
- return _z;
- }
- void Z(int value)
- {
- _z = value;
- }
- }
- }
- public class Capacity
- {
- private:
- int w;
- int h;
- int d;
- public:
- this(int width = 0, int height = 0, int depth = 0)
- {
- w = width;
- h = height;
- d = depth;
- }
- @property
- {
- int Width()
- {
- return w;
- }
- void Width(int value)
- {
- w = value;
- }
- int Height()
- {
- return h;
- }
- void Height(int value)
- {
- h = value;
- }
- int Depth()
- {
- return d;
- }
- void Depth(int value)
- {
- d = value;
- }
- }
- }
- public class Rectangle
- {
- private:
- Point _loc;
- Capacity _size;
- public:
- this(int x, int y, int z, Capacity size)
- {
- this(new Point(x, y, z), size);
- }
- this(Point loc, int width, int height, int depth)
- {
- this(loc, new Capacity(width, height, depth));
- }
- this(int x, int y, Capacity size)
- {
- this(new Point(x, y), size);
- }
- this(Point loc, int width, int height)
- {
- this(loc, new Capacity(width, height));
- }
- this(int x, int y, int width, int height)
- {
- this(new Point(x, y), new Capacity(width, height));
- }
- this(int x, int y, int z, int width, int height, int depth)
- {
- this(new Point(x, y, z), new Capacity(width, height, depth));
- }
- this(Point loc, Capacity size)
- {
- _loc = loc;
- _size = size;
- }
- @property
- {
- Point Location()
- {
- return _loc;
- }
- void Location(Point value)
- {
- _loc = value;
- }
- Capacity Size()
- {
- return _size;
- }
- void Size(Capacity value)
- {
- _size = value;
- }
- int X()
- {
- return _loc.X;
- }
- void X(int value)
- {
- _loc.X = value;
- }
- int Y()
- {
- return _loc.Y;
- }
- void Y(int value)
- {
- _loc.Y = value;
- }
- int Z()
- {
- return _loc.Z;
- }
- void Z(int value)
- {
- _loc.Z = value;
- }
- int Width()
- {
- return _size.Width;
- }
- void Width(int value)
- {
- _size.Width = value;
- }
- int Height()
- {
- return _size.Height;
- }
- void Height(int value)
- {
- _size.Height = value;
- }
- int Depth()
- {
- return _size.Depth;
- }
- void Depth(int value)
- {
- _size.Depth = value;
- }
- int Left()
- {
- return X;
- }
- int Top()
- {
- return Y;
- }
- int Right()
- {
- return X + Width;
- }
- int Bottom()
- {
- return Y + Height;
- }
- }
- RECT toRECT()
- {
- RECT rect;
- rect.left = Left;
- rect.top = Top;
- rect.right = Right;
- rect.bottom = Bottom;
- return rect;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement