diff options
| author | XaviDCR92 <xavi.dcr@gmail.com> | 2018-08-05 18:06:49 +0200 |
|---|---|---|
| committer | XaviDCR92 <xavi.dcr@gmail.com> | 2018-08-05 18:06:49 +0200 |
| commit | efc7020defa40c74a467442e6763df71c0783fd0 (patch) | |
| tree | fa3f7cf7648e7e05ed0483cf25ead7712f2fc0da /Coordinates.cpp | |
| parent | 6ecb59761ac940e66c9670d23dd65696df3df7cf (diff) | |
* Increased MAX_SELECTION_DISTANCE, but this should be done according to BaseUnit instead!HEADmaster
+ BaseUnit now takes a pointer to a Camera object.
+ Implemented Unit basic movement.
+ Initial stub for Coordinates class, meant to replace all manual X/Y coordinates handling between classes.
Diffstat (limited to 'Coordinates.cpp')
| -rw-r--r-- | Coordinates.cpp | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/Coordinates.cpp b/Coordinates.cpp new file mode 100644 index 0000000..95fd398 --- /dev/null +++ b/Coordinates.cpp @@ -0,0 +1,75 @@ +/* ******************************************************************* + * Includes + * ******************************************************************/ + +#include "Coordinates.h" + +/* ******************************************************************* + * Defines + * ******************************************************************/ + +/* ******************************************************************* + * Types definition + * ******************************************************************/ + +/* ******************************************************************* + * Global variables definition + * ******************************************************************/ + +/* ******************************************************************* + * Local variables definition + * ******************************************************************/ + +/* ******************************************************************* + * Local prototypes declaration + * ******************************************************************/ + +/* ******************************************************************* + * Functions definition + * ******************************************************************/ + +/*****************************************************************//** + * + * \brief Constructor for Coordinates class. + * + *********************************************************************/ +Coordinates::Coordinates(const Coordinates::tPos x, const Coordinates::tPos y) : +_x(x), +_y(y) +{ +} + +/*****************************************************************//** + * + * \brief Reportedly, returns X coordinate position. + * + *********************************************************************/ +Coordinates::tPos Coordinates::getX(void) const +{ + return _x; +} + +/*****************************************************************//** + * + * \brief Reportedly, returns Y coordinate position. + * + *********************************************************************/ +Coordinates::tPos Coordinates::getY(void) const +{ + return _y; +} + +/*****************************************************************//** + * + * \brief This function adds X/Y coordinates to a Coordinates + * object. Overloaded function for \ref Coordinates objects. + * + * \param + * + *********************************************************************/ +Coordinates Coordinates::operator+(const Coordinates& c) const +{ + const Coordinates::tPos x = c.getX() + _x; + const Coordinates::tPos y = c.getY() + _y; + return Coordinates(x, y); +} |
