[Scummvm-cvs-logs] SF.net SVN: scummvm:[55476] scummvm/trunk/common/rect.h

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sun Jan 23 20:00:36 CET 2011


Revision: 55476
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55476&view=rev
Author:   thebluegr
Date:     2011-01-23 19:00:35 +0000 (Sun, 23 Jan 2011)

Log Message:
-----------
COMMON: Added some very simple operators to the Point class (+, -, += and -=), taken from the BS25 Vertex class

Modified Paths:
--------------
    scummvm/trunk/common/rect.h

Modified: scummvm/trunk/common/rect.h
===================================================================
--- scummvm/trunk/common/rect.h	2011-01-23 17:52:29 UTC (rev 55475)
+++ scummvm/trunk/common/rect.h	2011-01-23 19:00:35 UTC (rev 55476)
@@ -43,7 +43,19 @@
 	Point(int16 x1, int16 y1) : x(x1), y(y1) {}
 	bool operator==(const Point &p) const { return x == p.x && y == p.y; }
 	bool operator!=(const Point &p) const { return x != p.x || y != p.y; }
+	Point operator+(const Point &delta) const {	return Point(x + delta.x, y + delta.y);	}
+	Point operator-(const Point &delta) const {	return Point(x - delta.x, y - delta.y);	}
 
+	void operator+=(const Point &delta) {
+		x += delta.x;
+		y += delta.y;
+	}
+
+	void operator-=(const Point &delta) {
+		x -= delta.x;
+		y -= delta.y;
+	}
+
 	/**
 	 * Return the square of the distance between this point and the point p.
 	 *


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list