Dragonfly  4.3
A text-based game engine
Box.h
1 ///
2 /// A 2-d bounding box
3 ///
4 
5 #ifndef __BOX_H__
6 #define __BOX_H__
7 
8 #include "Vector.h"
9 
10 namespace df {
11 
12 class Box {
13 
14  private:
15  Vector m_corner; ///< Upper left corner of box.
16  float m_horizontal; ///< Horizontal dimension.
17  float m_vertical; ///< Vertical dimension.
18 
19  public:
20  /// Create box with upper-left corner, horiz and vert sizes.
21  Box(Vector init_corner, float init_horizontal, float init_vertical);
22 
23  /// Create box with (0,0) for corner, and 0 for horiz and vert.
24  Box();
25 
26  /// Set upper left corner of box.
27  void setCorner(Vector new_corner);
28 
29  /// Get upper left corner of box.
30  Vector getCorner() const;
31 
32  /// Set horizontal size of box.
33  void setHorizontal(float new_horizontal);
34 
35  /// Get horizontal size of box.
36  float getHorizontal() const;
37 
38  /// Set vertical size of box.
39  void setVertical(float new_vertical);
40 
41  /// Get vertical size of box.
42  float getVertical() const;
43 
44  bool operator==(const Box &other) const; ///< Compare boxes.
45  bool operator!=(const Box &other) const; ///< Compare boxes.
46 };
47 
48 } // end of namespace df
49 #endif //__BOX_H__
void setVertical(float new_vertical)
Set vertical size of box.
Vector getCorner() const
Get upper left corner of box.
bool operator!=(const Box &other) const
Compare boxes.
float m_vertical
Vertical dimension.
Definition: Box.h:17
A 2-d bounding box.
Definition: Box.h:10
void setCorner(Vector new_corner)
Set upper left corner of box.
bool operator==(const Box &other) const
Compare boxes.
float getVertical() const
Get vertical size of box.
float m_horizontal
Horizontal dimension.
Definition: Box.h:16
Box()
Create box with (0,0) for corner, and 0 for horiz and vert.
void setHorizontal(float new_horizontal)
Set horizontal size of box.
Vector m_corner
Upper left corner of box.
Definition: Box.h:15
Definition: Box.h:12
float getHorizontal() const
Get horizontal size of box.
Definition: Vector.h:10