From d763e294f44eb38b94bf7e2055b77a982b72b7c0 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 16 Aug 2009 17:34:00 +0000 Subject: more constness --- src/math/vector2f.h | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'src/math/vector2f.h') diff --git a/src/math/vector2f.h b/src/math/vector2f.h index 6258d85..ba60aa1 100644 --- a/src/math/vector2f.h +++ b/src/math/vector2f.h @@ -78,6 +78,28 @@ public: return coord[index]; } + /// x coordinate + inline float width() const { + return coord[0]; + } + + /// y coordinate + inline float height() const { + return coord[1]; + } + + /// x coordinate + inline float x() const { return coord[0]; } + + /// y coordinate + inline float y() const { return coord[1]; } + + /// mutable reference to the x coordinate + inline float & get_x() { return coord[0]; } + + /// mutable reference to the y coordinate + inline float & get_y() { return coord[1]; } + /// a pointer to the internal data inline float *ptr() const { return (float *) coord; @@ -91,20 +113,6 @@ public: return ((x >= 0) && (y >= 0) && (x <= coord[0]) && (y <= coord[1])); } - inline float width() const { - return coord[0]; - } - - inline float height() const { - return coord[1]; - } - - /// x coordinate - float &x; - - /// y coordinate - float &y; - private: float coord[2]; }; -- cgit v1.2.3